Calling script in a Stored Procedure
I have this script and want to use it in a stored procedure but while creating it, it showed me an error:
Error: Query : CREATE PROCEDURE test.loadXMLData() BEGIN LOAD XML LOCAL INFILE
UserApplication.xml' INTO TABLE userapplicatio... Error Code : 1314 LOAD XML is not allowed in stored procedures
Query:
LOAD XML LOCAL INFILE 'UserApplication.xml'
INTO TABLE userapplication
ROWS IDENTIFIED BY '<Group>';
please Help me Out for finding where i m exactly making a mistake....
Hello,
For me it looks like a MySQL statement, right?
This is a Forum for Microsoft SQL Server; you better should post your question to a more related forum. =>
http://forums.mysql.com/
Olaf Helper
[ Blog] [ Xing] [ MVP]
Similar Messages
-
Hi,
i havea requirement where in i should be able to call my shell script through oracle stored procedure.i tried the following way..but iam unable to get the result.please find the details below.
new.sh - my shell script - lctfile (LCTFILE) is the input pa
v_config_file=`find $FND_TOP -name LCTFILE
FNDLOAD apps/s0ccer@$dxbs1 0 Y DOWNLOAD $v_config_file /home/bir4163/RPT33/bin/menu.ldt MENU MENU_NAME='AR_NAVIGATE_GUI'
if [ $? != 0 ];then
echo "$DATE $0 FNDLOAD DOWNLOAD Failed!" | tee -a $LOG_FILE
else
echo "SUCCESS" | tee -a $LOG_FILE
fi
CREATE OR REPLACE PROCEDURE test_dbms_scheduler
AS
v_text VARCHAR2 (255) := 'AR_NAVIGATE_GUI';
BEGIN
DBMS_OUTPUT.put_line ('I am in Procedure');
DBMS_SCHEDULER.create_job (
job_name => 'test_dbms_scheduler',
job_action => '/home/bir4163/RPT33/bin/new.sh',
number_of_arguments => 1,
job_type => 'executable',
start_date => SYSDATE,
repeat_interval => 'FREQ=SECONDLY; INTERVAL=1',
enabled => FALSE,
auto_drop => FALSE,
comments => 'run shell script'
DBMS_SCHEDULER.set_job_argument_value (job_name => 'test_dbms_scheduler',
argument_position => 1,
argument_value => v_text);
DBMS_SCHEDULER.enable ('test_dbms_scheduler');
DBMS_OUTPUT.put_line ('I am back in Procedure');
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLCODE || SQLERRM);
END;
But iam unable to test it as i do not have permissions to access dbms_scheduler.can anybody tell me how to solve this using DBMS_PIPE with a sample code.
please do help its very urgent
thanks
ramyaHi,
Register your Shell Script as a concurrent program, Executable execution method "Host", then use fnd_request.submit_request to submit the program.
Regards,
Andries -
Executing Unix scripts from a stored procedure
From the sql*plus windows, I am able to execute the host command and '!sh' commands; but I need to ececute Unix scripts from a stored procedure. Hoe can I do this? Where can I get good documentation on this? Any help would be greatly appreciated!
Thanks..Hi,
U can use external procedure ( newly added feature in 8.0.3 onwards) and call any shared library. From shared library u can execute it.
One sql command is there HOST(' '). U can run a OS command. But u can not use it in PL/SQL.
U can call pls sql from shell !!!!!..
Thanks...
Boby Jose -
Using SQL Loader script in a Stored Procedure
Can I use SQL Loader script in a stored procedure and then execute it from a front-end appl.? The reason for this seemingly convoluted solution is that the users don't want a batch load though the records volume is quite high (around 1 mil). Other loads using ODBC connection or OLE DB seem to be inferior to SQL Loader.
I would suggest a couple of solutions:
1. Have a cgi script that can upload the file to the server from a web ui, then have the cgi script call the sql*loader file, and it will insert into the database.
2. You can try to use External tables. This is avaliable in 9i and onwards. You will be able to make any sql DML on the external table.
I would normally use sql*loader, move the data to a staging table with nologging, and paralle loading. After it has been loaded into the staging table I would process it into my main tables. Have used this approach with up to 60 million records in one load.
You can do calls to C procedures, Pro*C procedures through PLSQL, as well as java calls, or use Java stored procedures.
My experience is that SQL*Loader is the fastest way to load data into the database. -
Shell script invoke from stored procedure
Hi All,
Can anyone tell me how to call UNIX SHELL SCRIPT from oracle stored procedure PL/SQL. Example with detailed explanation.
Please Share the needful.
Thanks in Advance
PricksHere, The example is given below, I want to invoke the Script which i mentioned like HERE INVOKE THE ABOVE SHELL SCRIPT in that place.
CREATE OR REPLACE PROCEDURE spwritelog
inFileName VARCHAR2,
inLogMsg VARCHAR2,
inLogLevel CHAR(1),
outRc OUT NUMBER
AS
tmpMsg VARCHAR2(255);
BEGIN
outRc := 0;
IF inLogLevel = 'X' THEN
tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> " || inFileName;
HERE INVOKE THE ABOVE SHELL SCRIPT
ELSIF inLogLevel = "9" THEN
tmpMsg := "echo `date +'%Y-%m-%d %H:%M:%S'` ' " || inLogMsg || "' >> /tmp/spAllLog.err";
HERE INVOKE THE ABOVE SHELL SCRIPT
END IF;
EXCEPTION
WHEN OTHERS THEN
outRc:=SQLCODE;
END spwritelog;
Please correct the code and tell.......
please share the needful
Edited by: 866916 on Aug 19, 2011 5:38 PM -
Calling SQL * LOADER in stored procedure
Hi Experts,
Can we call sql*loader in stored procedures? . If yes , please let me know the syntax.
Any help will be highly appreciated.
Thanks.You can also use dbms_schedular to execute any shell or batch file - i guess ->
BEGIN
-- UNIX
DBMS_SCHEDULER.create_job(
job_name => 'unix_command_job',
job_type => 'EXECUTABLE',
number_of_arguments => 1,
job_action => '/bin/ls',
auto_drop => FALSE,
enabled => FALSE);
DBMS_SCHEDULER.set_job_argument_value('unix_command_job',1,'/tmp');
DBMS_SCHEDULER.set_attribute('unix_command_job', 'credential_name', 'TIM_HALL_CREDENTIAL');
DBMS_SCHEDULER.set_attribute('unix_command_job', 'destination', 'marge.localdomain:65001');
DBMS_SCHEDULER.enable('unix_command_job');
END;For details ->
http://www.oracle-base.com/articles/11g/SchedulerEnhancements_11gR1.php
http://www.oradev.com/dbms_scheduler.jsp
http://www.psoug.org/reference/dbms_scheduler.html
Regards.
Satyaki De. -
How to call sqlldr utility in stored procedure
Hi,
i want to call sqlldr exe from stored procedure.
Regards,
Tushar Josihuser12044491 wrote:
currently i am working on oracle release 10g R2.
i am not very much sure whether all CTL option are available in the external table.Before you decide on the method you should clearly understand the following. SQL*Loader is client side tool while job and external table are server side tools. Therefore, unless you are connecting to oracle from database server or file you are loading is accessible from database server, neither job nor external table will help you. And now back to your question - yes, not all SQL*Loader features are available for external tables but most of the time there is a way around it.
SY. -
How to call a sql server stored procedure from oracle
Hi all,
Please anybody tell me how to call a sql server stored procedure from oracle.
I've made an hsodbc connection and i can do insert, update, fetch data in sql server from oracle. But calling SP gives error. when I tried an SP at oracle that has line like
"dbo"."CreateReceipt"@hsa
where CreateReceipt is the SP of sql server and hsa is the DSN, it gives the error that "dbo"."CreateReceipt" should be declared.
my database version is 10g
Please help me how can i call it... I need to pass some parameters too to the SP
thanking youhi,
thank you for the response.
when i call the sp using DBMS_HS_PASSTHROUGH, without parameters it works successfully, but with parameters it gives the following error
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Generic Connectivity Using ODBC][Microsoft][ODBC SQL Server Driver]Invalid parameter number[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index (SQL State: S1093; SQL Code: 0)
my code is,
declare
c INTEGER;
nr INTEGER;
begin
c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@hsa;
DBMS_HS_PASSTHROUGH.PARSE@hsa(c, 'Create_Receipt(?,?)');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,1,'abc');
DBMS_HS_PASSTHROUGH.BIND_VARIABLE@hsa(c,2,'xyz');
nr:=DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@hsa(c);
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@hsa(c);
end;
Create_Receipt is the sp which requires two parameters.
please give me a solution
thanking you
sreejith -
Urgent : while calling a pl/sql stored procedure I am getting this error.
Error iam getting like this:
IDALException: ORA-06550: line 1, column 7: PLS-00201: identifier 'BORGPURCHASEDELEGATION_SEL' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored [ com.commerceone.ebs.infra.dal.idal.BasicSQL.oracleExceptionHandler(BasicSQL.java:863)]
ADALException: Default Message[ com.commerceone.ebs.infra.dal.adal.Adal.execute(Adal.java:765)]
ADALException: Default Message[ com.commerceone.ebs.infra.dal.adal.Adal.executeEbo(Adal.java:605)]
BusinessFatalException: Default Message[ com.commerceone.ebs.wf.business.PurchaseBorgDelegation.getData(PurchaseBorgDelegation.java:483)]
CommandException: Default Message[ com.commerceone.ebs.apps.profile.command.UserProfilePurchaseDelegationSaveCmd.execute(UserProfilePurchaseDelegationSaveCmd.java:124)]
ActionException: Default Message[ com.commerceone.ebs.apps.base.action.ActionImpl.executeCommand(ActionImpl.java:107)]
JobException: Default Message[ com.commerceone.ebs.apps.ui.WebJobImpl.executeAction(WebJobImpl.java:115)]
JobException: Default Message[ com.commerceone.ebs.apps.ui.BuyerJob.executeAction(BuyerJob.java:750)]
JobException: Default Message[ com.commerceone.ebs.apps.ui.BuyerJobWrapper.run(BuyerJobWrapper.java:64)]
Thanks
rajiThis has happened to me when I do not have the proper grants and/or synonyms set up. My JDev/J2EE connection user does not own the database objects so I need to grant access to the database object owner's database account and create synonyms available to the connection user's database account. If you are using the same database account in your JDev/J2EE connection object as you are using to run the stored proc in SQL*Plus, this is not your problem.
I would test each part of the database involvement. For example, if you create a database view (with no additional grants or synonyms) in the user account that owns that stored procedure, can you create an ADF BC view object from that view in JDev and can you run the BC tester in JDev on it? If so, the connection user and object owner user accounts are probably the same.
Another thing to try is, instead of executing the stored procedure, do something like this:
stmt = "DECLARE v_dummy; BEGIN SELECT 1 INTO v_dummy FROM dual; END;";If that works, your calling mechanism for the stored procedure works. -
Invoking Shell Script from JAVA Stored procedure
I am trying to invoke shell script using Java Stored procedure.
When I run my java class outside of oracle using oracle user
account it works but as soon as i load it into database and try
to inovoke that class using PL/SQL wrapper it runs java class
but is not able to invoke the shell script. Any ideas would be
greatly appreciated.Pleass search the forums for "runtime" as there are many threads and examples already posted.
-
Need Example on calling a unix shell script from oracle stored procedure
Hi
Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
Have a nice time.
Thanks & Regards
JogeshIf you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL
-
RFC call from MSSQL 2000 stored procedure
Hi. I need call SAP RFC transaction from stored procedure of MS SQL Server 2000.
When i'm execute example from T-SQL Help it's work perfect
Examples
A. Use Prog ID
This example creates a SQL-DMO SQLServer object by using its ProgID.
DECLARE @object int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
EXEC @hr = sp_OACreate 'SQLDMO.SQLServer', @object OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
When i'm execute:
DECLARE @object int
DECLARE @hr int
DECLARE @src varchar(255), @desc varchar(255)
EXEC @hr = sp_OACreate 'SAP.Functions',
@object OUT
IF @hr <> 0
BEGIN
EXEC sp_OAGetErrorInfo @object, @src OUT, @desc OUT
SELECT hr=convert(varbinary(4),@hr), Source=@src, Description=@desc
RETURN
END
i'm recieve error:
0x800401F3
ODSOLE Extended Procedure
Wrong string with class name
BUT! This example work perfect via another way: in VBS script, in VBA macros, in Visual FoxPro program.
What wrong in MS SQL ???Hi Vitaly Ashmarin.
Pls, Did you solve this issue?
Ty -
Shell script execution from stored procedure
I am working on a project thallt requires a shell script be executed upon the execution of a stored procedure with Oracle 10g. I have researched the matter, but there does not seem to be much out there on how to execute lines of UNIX commands by use of a stored procedure. If anybody has ever gotten this to work, any information would be appreciated. If the task is impossible, let me know, I just could not confirm that it was not something that could be done.
A combination of things can help you out here - none of which are easy or particularily secure.
1) From plain PL/SQL, you can call 'external procedures'. That is basically a DLL or .so that the listener can load on demand, and that external procedure (EXTPROC) can run whatever you need from the C program. C can, in turn, call a shell.
This is fairly well documented, but be aware that 1/2 of the info is in the PL/SQL docco and the other half in the Networking docco.
A fair bit of info is available in metalink as well - if you have access, simply search on extproc.
2) You can call a Java stored procedure which in turn has hooks to the outside world. That will probably require a PL/SQL to Java wrapper to make it available in your environment. Oracle has been using this one successfully for a while.
3) Write the script using UTL_FILE and have a daemon look for, and execute, the script.
4) Since you are using 10g, use the new job scheduler. It has excellent capability to interact with the OS, and it is available as a PL/SQL package (DBMS_SCHEDULER). I find the interface a bit heavy, but that could be wrapped by a library tailored to your specific needs.
Let us know what you decide to do in the end (and why) - it is an interesting topic. -
Call a pl/sql stored procedure from a report link
Hello everyone:
I have a report with a link in a column, which takes you to another page and passes values to that page, but also need the link, run a stored procedure before going to the other page.
In the Forum I found cases similar to this, but none of the examples is clear to me how I do this. It seems that the target of the link should be URL, and also I have to call the stored procedure with a javascript function.
My questions are:
- Is this the best method to make what I need?
- How should be the syntax of the link that takes me to another page and run the "stored procedure"
- How and where I put the function "javascript" to run the "stored procedure"
BDD: Oracle 11 g
Apex version 4.1
Best regards
GerardHi,
Change the link to call an apex.submit process. (javascript).
Edit:
I've set up a basic example.
Region 1 (just so you can see the value getting set):
select :P27_HIDDEN item_Value
from dual
Region 2:
select rownum id, dbms_random.string('U', 12) sss
from dual
connect by level <= 20
item attributes for ID:
Target: URL
URL: javascript:apex.submit({request:'NAVIGATE', set:{'P27_HIDDEN':#ID#}});
(P27_HIDDEN is just a hidden item i created)
http://apex.oracle.com/pls/apex/f?p=54920:27
Edit2:
In your case, then you can just have a page process based on conditions request = expression1, expression1: NAVIGATE..... then a page branch to go to the desired page, also with the same conditions
Edit3:
Im not sure what examples you are referring to , as you didn't supply any links; but you mention calling the stored procedure from javascript, so would likely involve some AJAX, but imo not necessary. -
Error calling Java in Oracle Stored Procedure
I can call a java function inside my Oracle Stored Procedure, but if I reference a class that uses JNI, I get problems. I don't know what forum to post this under. This seems the closest match.
Here is my error:
java.lang.NoClassDefFoundError
at AcmeComp.ec.Motor.<init>(Motor.java:35)
at BBOra.runBB(BBOra:13)
Here is my java class, BBOra.java:
import AcmeComp.ec.*;
class BBOra {
static String strCnt;
BBOra() {}
public static void runBB() {
try {
//Motor class is in AcmeComp.ec package
Motor eng = new Motor();
} catch(Exception e) {
System.out.println("Error: " + e);
public static void runNonBB() {
System.out.println("runNonBB works ok.");
From DOS prompt, I loaded ac222ec.jar (has the AcmeComp.ec package) and BBOra.java files into Oracle:
loadjava -u system/manager -resolve -verbose ac222ec.jar.java
loadjava -u system/manager -resolve -verbose BBOra.java
From SQL Plus, I created 2 stored sprocedures:
CREATE OR REPLACE PROCEDURE runBB
AS LANGUAGE JAVA
NAME 'BBOra.runBB()';
CREATE OR REPLACE PROCEDURE runNonBB
AS LANGUAGE JAVA
NAME 'BBOra.runNonBB()';
From SQL Plus, I gave myself permissions to load libraries, so I can load ac222ecjni.dll, which has all the Native (C++) code I use:
BEGIN
DBMS_JAVA.GRANT_PERMISSION('SYSTEM',
'java.lang.RuntimePermission',
'loadLibrary.*');
END;
From SQL Plus, I set up my output:
set SERVEROUTPUT ON;
CALL dbms_java.set_output(3000);
From SQL Plus, I called my Stored Procedures:
CALL runNonBB();
CALL runBB();
runNonBB() works great, but runBB() gives me the error I listed above. The Motor class that BBOra calls, itself calls a class NMotor, which has a call:
static {
System.loadLibrary("ac222ecjni");
Unfortunately, I don't know the inner workings of the native code. Does "at AcmeComp.ec.Motor.<init>(Motor.java:35)"? mean JServer was able to see the class "Motor", but not instatiate it? Or did it error trying to create the class "NMotor"?
Here's a snippet of Motor:
package AcmeComp.ec;
public class Motor implements IMotor {
public Motor() {
motor = new NMotor();
some functions
private NMotor motor;
Here's a snippet of NMotor:
package AcmeComp.ec;
class NMotor {
NMotor() {
sunjdk = true;
some native method declarations
private boolean sunjdk;
static {
//ac222ecjni.dll has all the Native (C++) code
System.loadLibrary("ac222ecjni");
PLEASE HELP ME FIGURE THIS OUT. IT IS KILLING ME. I can even look into the USER_OBJECTS view in Oracle and see that ALL of the classes from the ac222ec.jar are present and accounted for.Man, I guess I figured it out myself. Ten Duke dollars to myself. But, for the sake of anyone who may want to know the answer, here it is:
JServer (or Oracle9i JVM in Oracle 9i) does not support JNI. Here is their (weak) reasoning, taken from "Oracle9i Java Developer's Guide" as found in http://www.csis.gvsu.edu/GeneralInfo/Oracle/java.920/a96656/invokeap.htm#1007948
"Oracle does not support the use of JNI in Oracle9i Java applications. If you use JNI, your application is not 100% pure Java, and the native methods require porting between platforms. Native methods have the potential for crashing the server, violating security, and corrupting data."
Sounds like a fancy way to say they have a limitation--their JVM isn't up to par all the way. If JNI is a feature in Java, why should Oracle decide for me if I should use it? Don't Java methods also have the potential for crashing the server, violating security, and corrupting data? I think they should just provide the functionality you would expect from a VM and let the user decide which functionality to use. In my case, I HAVE to use JNI, so I'd have to use RMI so that a different VM can do the JNI part.
Sounds pretty lame of Oracle, but oh well.
Maybe you are looking for
-
Flex 2 Builder: Variables view pane & AS3 component debugging.
The problem is as follows: A supposed ComponentA (ActionScript 3.0 class component in package components.* & extending mx.coreUIComponent) is placed in the main application: // script <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" xmlns:c
-
Hi, I want to change my local IWeb site and upload it to a server host....(For example: "http://www.machighway.com") Will I be able to upload files just as they are locally and drop them unto the server? Otherwise, who offers the most affordable mont
-
What is the last version of Final Cut available for the G5 PPC & OS X 10.5?
What was the last version of Final Cut available for the G5 PPC running OS X Leopard? I'd like to get a copy (from ebay or some other vendor).
-
Server error 503 when running On-demand HTTP Dynamic Streaming tutorial
Hi, I'm trying to set up an HTTP Dynamic Streaming environment for VoD (not live streaming). I'm following the instructions in the HTTP Dynamic Streaming Quick Start guide (http://help.adobe.com/en_US/HTTPStreaming/1.0/Using/WS8d6ed60bd880807c48597a9
-
I can't open mail app in my mac?
because mail is different version of my mac