using pl/sql external package and getting error with declaration - plsql

I need to run a procedure in a package external to my script. The script is in an APEX page:
begin
idsud.segyload.loaddataset(p_dataset_id => :p40_dset, p_mode => 'INIT');
end;
When I try to use this I get an error saying that I must declare the "idsud.segyload" package. How to do this?

Have you added the appropriate permissions?
e.g. GRANT EXECUTE ON idsud.segyload TO {apex_schema};

Related

OpenEdge 10.2A - Unable to Run the Added Procedure in Custom .pl File

I have added a new .p procedure (prodict/myProc.p) in prodict.pl file and saved the prodict.pl file under my program's root folder.
Also, I have added the path of the folder to the PROPATH and it is the first item in the PROPATH.
In order to run the procedure, in the Procedure Editor, I try to run using the code below
RUN prodict/myProc.p
The error message I receive is:
How can I make my procedure run?
Note: I'm trying this in order to create a custom prodict/load_df.p, so it can be run without the need of any user interaction. My older question can be found here.
Instead of RUN "prodict/myProc.p", I have used
RUN value(search("prodict/myProc.p")).
The error message is changed to
Cannot run procedure file prodict/myProc.p from library. (1976)
When we look at the error description:
Can't run procedure file from library. (1976)
The named file in the library reference (e.g, progname.p in libname.pl<>) in the RUN statement is a source file, and cannot be run. Only PROGRESS r-code files can be run from a library.
Solution: I have added the compiled .r file to the library through proenv:
prolib prodict.pl -add prodict/myProc.r
and changed the calling code as:
RUN "prodict/myProc.r".
Now the code runs. Thanks to Stefan Drissen for showing me a way to get the real error message.

XQuery process:execute how to execute external programm?

I am running exist-db on windows and would like to execute an external windows program.
This works inside the normal windows shell:
C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90
And I would like to execute the same program from my xquery script (I have uploaded all the needed files according to my specified paths to my exist-db):
xquery version '3.1';
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
declare variable $options := '<options>
<workingDir>/db/apps/test-project/images</workingDir>
<stdin><line>/db/apps/execute-test/images/image1.rti -q 90</line></stdin>
</options>';
(:process:execute($webRtiMaker, <options/>):)
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', $options)
Even if I only execute the program without parameters (if I execute it inside windows I get the parameters as overview inside the command prompt so I should also receive some kind of output):
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', <options/>)
But I get the error:
exerr:ERROR An IO error occurred while executing the process /db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe: Cannot run program "/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe": CreateProcess error=2, The System cannot find the file ...
I used this as reference: Execute External Process
What am I doing wrong?
I have not tried this recently, but try the following:
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
let $cmd := 'C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90'
return
<results>{process:execute($cmd, <options/>)}</results>
There is an article at the XQuery WikiBook about it.
Unfortunately it is not possible to start an executable that is stored inside the database. The java API requires direct access to a file on the filesystem, and the '/db/....' path is not.

marklogic undefined function error xdmp:server-root

when i run the script xdmp:server-root(xdmp:server("http-cvsearch-8200")) in Marklogic Console, i got an error: the xdmp:server-root() function is not defined. The ML version is 8.0-3.2.
I tried another function and it works well.
let $config := admin:get-configuration()
return admin:appserver-get-root($config,xdmp:server())
Probably you were executing the command on the qconsole attached with a database as a source, remember that xdmp:server-root works on AppServers, XDBC or ODBC server.

Cannot use default Oracle 11G package utl_file

I'm using PLSQL Developer client to access my 11G Oracle database. My understanding is that these are the default packages that come with this version. However, if I try to declare a utl_file.file_type variable, I get the following error:
PLS-00201: identifier 'UTL_FILE' must be declared
My program:
declare
l utl_file.file_type;
begin
NULL;
end;
I've tried to declare, for instance, a DBMS_LOB.BFILE, and it compiled succesfully, that prooves that some other packages are imported in my block.
Aren't all Oracle default packages automatically imported?
My assumption that if it's yours database, you have got pass for user SYS. If it is, you should check if package utl_file is installed. You can connect by SYS and execute this statement
SELECT * FROM dba_objects WHERE object_name = 'UTL_FILE'
You should see if that package exists. Also you should see object type 'SYNONYM' with owner 'PUBLIC'. If package present in DB, but there is no synonym for it, you can create it using this statement
CREATE PUBLIC SYNONYM OF UTL_FILE FOR SYS.UTL_FILE
If there is no such package - you should install it, by executing script, which is located in
{ORACLE_HOME}/rdbms/admin/utlfile.sql

Grant UTL_HTTP permission in PLSQL

I would like to get HTML content from a certain webpage in my function. I read I can do it with the UTL_HTML package in PLSQL. So I made the following code in the project:
v_webcontent := utl_http.request(v_weblink);
Here the v_webconent and v_weblink are declared earlier. running this in de function gives an PLSQL exception: PLS-00201: identifier 'UTL_HTTP' must be declaredI guess this problem is because the package isn't available (from this link: same error message).
I followed the advice. So I created a new database connection in sql developer as the SYSTEM role (SYS didn't work, it sayd I could only logon using SYSDBA or SYSOPER but both wouldn't take the standard password I created with the database). Then I entered the code in the link above.
GRANT EXECUTE ON SYS.UTL_HTTP TO [database];
The user I created is named 'Database'. It first gave me an error without the [] square brackets. Table or view does not exist so I then put the brackets around it. Now it gives error:
Error starting at line : 1 in command -
GRANT EXECUTE ON SYS.UTL_HTTP TO [database]
Error report -
SQL Error: ORA-00987: missing or invalid username(s)
00987. 00000 - "missing or invalid username(s)"
*Cause:
*Action:
So I have no idea how to fix this. In the link above OP said that he got an other error, so I also checked if I didn't have the same problem. I entered:
SELECT * FROM dba_objects WHERE object_name='UTL_HTTP'
It returned 4 entry's. With owners: SYS, SYS, PUBLIC and APEX_040000.
Can somebody help me? Do I need to logon as SYS and with what passwords?
Since 11g you also have to create an access control list ('ACL') which specifies which users have access to particular domains, it is no longer sufficient to just grant users execute privileges on utl_http!
Something like this should work in 11g(after granting execute privileges on UTL_HTTP to your database user, as specified by the accepted answer) :
SQL> BEGIN
2 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(acl=>'mikesacl.xml',
3 description=>'access control list example',
4 principal=>'HR',
5 is_grant=>TRUE,
6 privilege=>'connect');
7 commit;
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> begin
2 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(
3 acl=>'mikesacl.xml',host=>'*');
4 commit;
5 end;
6 /
PL/SQL procedure successfully completed.
Here is a very helpful link which explains the parameters of the above two functions :
http://www.oracleflash.com/36/Oracle-11g-Access-Control-List-for-External-Network-Services.html
Good luck!
Log on as SYS AS SYSDBA.
Execute grant execute on sys.utl_http to "Database"; Do not use any square brackets!
That should work.
Piece of advice: Do not name your DB user 'Database'.
To reset your SYS password
Run cmd.exe as administrator.
cd to your ${ORACLE_HOME}/database.
Find the PWDsomething.ora file there (where something will be your instance name), copy its name (into clipboard).
Run orapwd file=PWDsomething.ora password=SomePasswordOfMine force=y, where PWDsomething.ora will be replaced with the file name from the step 3 and SomePasswordOfMine must be replaced by whatever password you wish to have.
That might work.

Resources