Call complex type oracle procedures
Hello!
My task is to call some stored procedures from Oracle. These procs developed by other guy.
The trouble is that some of the OUT parameters are TABLE or VARRAY of OBJECT types.
Here is example of procedure:<br>
<br>
<br>
type tag_event_varray as varray(100) of tag_event_object
...<br><br>
TYPE tag_event_object AS object(
tag_event_id NUMBER,
tag_id number......
......<br>
<br>
PROCEDURE get_tag_events(p_customer_id in number, <br>
p_site_id in number,
p_tag_event_varray out tag_event_varray,
p_feedback_varray out feedback_varray); <br><br>
------------------------------------------------------------------<br><br>
All documentation I found on the web is about fetching either REF CURSOR or VARRAY of simple elements like number...<br><br>
I have tried this:<br><br>
// connection do DB <br>
<br>
$s = OCIParse($c, "begin get_tag_events(:bind1, :bind2,:bind3, :bind4); end;");<br>
$coll = OCINewCollection($c, "TAG_EVENT_VARRAY");<br>
.........<br>
OCIBindByName($s, ":bind3", $coll, -1, OCI_B_SQLT_NTY); <br>
OCIExecute($s, OCI_DEFAULT);<br>
for ($i = 0; $i < $coll->size(); $i++) {<br>
$id = $coll->getElem($i);<br>
echo "Id: $id<br>";<br>
} <br>
----------------------------------------------------------<br>
$coll->size() gives the right size of collection, but getElem() is empty.<br>
Any suggestions?<br>
Help is very appreciated
It appears that you're trying to manage a VARRAY collection of a user-defined object type. If that's true, then my understanding is that it shouldn't work with the current OCI8 libraries. OCI8 only supports collections of scalar data types, like NUMBER, DATE, et cetera.
You can change the PL/SQL code to return a parallel set of scalar collections and then the PHP logic flow you're using will work.
Hope this helps, Michael.
Similar Messages
-
OCI 22303 exception - Pass object to type Record in oracle procedure
Recently i had my first encounter with ODP.NET and Oracle. I'm developing a a datalayer that can access a stored procedure on an Oracle database.
The problem i'm having is the following:
I'm using this method to pass my parameters to the procedure: http://www.codeproject.com/KB/cs/CustomObject_Oracle.aspx
I have also attempted this approach:
http://developergeeks.com/article/48/3-steps-to-implement-oracle-udt-in-odpnet
I always get the message (litteraly):
Oracle.DataAccess.Client.OracleException: OCI-22303: type "e;PAC$WEBSHOP_PROCS"."CUSTOMER_IN_RECTYPE" not found.
It sounds weird to me, but what are the "es doing here in the error message I see?
Some code i use:
OracleParameter objParam = new OracleParameter
OracleDbType = OracleDbType.Object,
Direction = ParameterDirection.Input,
ParameterName = "PAC$WEBSHOP_PROCS.P_CUSTOMER_IN",
UdtTypeName = "PAC$WEBSHOP_PROCS.WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE",
Value = card
The information i have about the Oracle procedure:
CREATE OR REPLACE PACKAGE PAC$WEBSHOP_PROCS IS
TYPE CUSTOMER_IN_RECTYPE IS RECORD
(CUS_STO_IDENTIFIER NUMBER(2)
,CUS_IDENTIFIER NUMBER(6)
,CH_IDENTIFIER NUMBER(2)
,CH_CARD_VERSION NUMBER(1)
PROCEDURE PRC$WS_VALIDATE_CARD
(P_CUSTOMER_IN IN PAC$WEBSHOP_PROCS.CUSTOMER_IN_RECTYPE
,P_RETURN_CODE IN OUT NUMBER
Any help to cover my problem would be greatly appreciated.
Thx
Edited by: 836497 on 14-feb-2011 4:36The only way to call it as is would be via an anonymous plsql block, where you create the record type inside the block. Interacting with the block via ODP would be limited to scalar values.
Here's a PLSQL example just to demonstrate. Here, v1 and v2 are bind variables of scalar type, which you'd setup/bind via ODP instead of the SQL prompt as I did, but I thought this might keep things simpler for the example.
The other choice would be to write a wrapper procedure that takes type OBJECT that you can call from ODP, and inside that procedure convert them to/from RECORD and call the original procedure.
Hope it helps,
Greg
SQL> drop package somepack;
Package dropped.
SQL> create package somepack as
2 type somerectype is record(n1 number);
3 function somefunc (v1 somerectype) return somerectype;
4 end;
5 /
Package created.
SQL>
SQL> create package body somepack as
2 function somefunc (v1 somerectype) return somerectype is
3 begin
4 return v1;
5 end;
6 end;
7 /
Package body created.
SQL>
SQL>
SQL> var v1 number;
SQL> exec :v1 := 5;
PL/SQL procedure successfully completed.
SQL> var v2 number;
SQL>
SQL>
SQL> declare
2 localvar1 somepack.somerectype;
3 localvar2 somepack.somerectype;
4 begin
5 localvar1.n1 := :v1;
6 localvar2 := somepack.somefunc(localvar1);
7 :v2 := localvar2.n1;
8 end;
9 /
PL/SQL procedure successfully completed.
SQL> print v2;
V2
5
SQL> -
Calling Oracle procedure with two OUT parameters
Hi I am having an Oracle procedure which return ref cursor. I also want to result one more out parameter result. How Can I call the procedure in SQL. Below is the way I am calling my stored procedure with one parameter.
proc_Test (p_resultset=> My_cursor)
How can I call the procedure when I have one more OUT parameter. Second parameter returns 0 or 1.
Thanks in advYes its possible to use multiple parameter as OUT type in procedure.
SQL>set serveroutput on size 1000000;
SQL>CREATE OR REPLACE PROCEDURE myproc(p_cv OUT SYS_REFCURSOR, p_num OUT NUMBER) AS
2 BEGIN
3 OPEN p_cv FOR SELECT 'Hello Oracle' sayhello FROM DUAL ;
4 p_num := 1;
5 END;
6 /
Procedure created.
SQL>VAR cv REFCURSOR;
SQL>VAR num NUMBER;
SQL>EXEC myproc(:cv, :num);
PL/SQL procedure successfully completed.
SQL>PRINT cv;
SAYHELLO
Hello Oracle
SQL>PRINT num;
NUM
1
SQL>
{code} -
On making call to Oracle procedures from Java, Value becomes null on oracle
We are using some user defined Oracle data types in my Java/J2EE application
and some of them are Oracle collections(ex. VARRAY).
We are making a call to Procedures/Functions from Java, there are some
parameters of user defined data types declared in the
procedures/functions, from java the values are properly setting to these
user defined data type parameters and sending to Procedures.
We are not getting any exception at Java side and Oracle side and values
are becoming blank/null at oracle procedure side for the parameters of
user defined data types.
But when do the count of collection of user defined data type then it is
properly giving the size of collection(VARRAY).
When we are trying to read the values from the collection(VARRAY) it is
giving blank/null value and there is no exception.
Please let me know if you have any suggestion on this?user7671994 wrote:
When we are trying to read the values from the collection(VARRAY) it is
giving blank/null value and there is no exception.If you are talking about VARCHAR2 parameters of the objects - then you should add orai18n.jar to classpath. -
RPC calls to Operations with complex types is it possible?
Using Remote Procedure Calls, and Document Literal Wrapped SOAP Messages
I have a complex type called
<customerCall>
<custId>
<custPhone>
<custName>
<custCat>
<custIssue>
<custOperator minoccurs = 0>
<custEnrollDate minoccurs = 0 >
I have an operation called getFirstAvailableOperator(currentCall) where current call is an instance of the customerCall type? Where getFirst AvailableOperator returns the complex type customerCall?Using Remote Procedure Calls, and Document Literal Wrapped SOAP Messages
I have a complex type called
<customerCall>
<custId>
<custPhone>
<custName>
<custCat>
<custIssue>
<custOperator minoccurs = 0>
<custEnrollDate minoccurs = 0 >
I have an operation called getFirstAvailableOperator(currentCall) where current call is an instance of the customerCall type? Where getFirst AvailableOperator returns the complex type customerCall? -
Problem in calling a WS with complex type
Hi all...
I have to invoke a WS that has as input type a complex type defined in the wsdl...
<complexType name="LoginInfo">
- <sequence>
<element name="appCode" nillable="true" type="string" />
<element name="login" nillable="true" type="string" />
<element name="passwd" nillable="true" type="string" />
</sequence>
</complexType>the soapui request looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://com.susan/SusanWS/types">
<soapenv:Header/>
<soapenv:Body>
<typ:LoginWebService>
<LoginInfo_1>
<appCode>WEB_SERVICES</appCode>
<login>root</login>
<passwd>root</passwd>
</LoginInfo_1>
</typ:LoginWebService>
</soapenv:Body>
</soapenv:Envelope>in my java code I'm trying to call it with:
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress( new URL( wsEndpoint ) );
// call.setOperationName( wsMethod );
call.setOperationName( new QName("http://com.susan/SusanWS/types",wsMethod));
call.addParameter( "LoginInfo_1", Constants.XSD_ANYTYPE, ParameterMode.IN );
// call.addParameter( "appCode", Constants.XSD_STRING, ParameterMode.IN );
// call.addParameter( "login", Constants.XSD_STRING, ParameterMode.IN );
// call.addParameter( "passwd", Constants.XSD_STRING, ParameterMode.IN );
String[] params={appCode, login, passwd};
// call.setReturnType( Constants.XSD_INT );
// Object retval = call.invoke( new String[] {appCode, login, passwd} );
Object retval = call.invoke( new Object[] { params } );doing so..it doesn't work...the first problem I can see...is that I don't assign a parameter name to the 3 strings I pass in the param array...
anybody has a tip to give me on how to solve this problem?solved...
I imported the wsdl into Intellij idea...which created all the needed classes, interfaces,...and used service locator and endpoint binding stubs... -
How to call an Oracle Procedure and get a return value in Php
Hi Everyone,
Has anyone tried calling an Oracle procedure from Php using the ora functions and getting the return value ? I need to use the ora funtions (no oci)because of compatibility and oracle 7.x as the database.
The reason why I post this here is because the ora_exec funtion is returning FALSE but the error code displayes is good. Is this a bug in the ora_exec funtion ?
My code after the connection call is as follows:
$cur = ora_open($this->conn);
ora_commitoff($this->conn);
$requestid = '144937';
echo $requestid;
$rc = ora_parse($cur, "begin p_ins_gsdata2
(:requestid, :returnval); end;");
if ($rc == true) {
echo " Parse was successful ";
$rc2 = ora_bind ($cur, "requestid", ":requestid", 32, 1);
if ($rc2 == true) echo " Requestid Bind Successful ";
$rc3 = ora_bind ($cur, "returnval", ":returnval", 32, 2);
if ($rc3 == true) echo " Returnval Bind Successful ";
$returnval = "0";
$rc4 = ora_exec($cur);
echo " Result = ".$returnval." ";
if ($rc4 == false) {
echo " Exec Returned FALSE ";
echo " Error = ".ora_error($cur);
echo " ";
echo "ErrorCode = ".ora_errorcode($cur);
echo "Error Executing";
ora_close ($cur);
The Oracle procedure has a select count from a table and it returns the number of records in that table. It's defined as:
CREATE OR REPLACE procedure p_ins_gsdata2 (
p_requestid IN varchar2 default null,
p_retcode OUT varchar2)
as
BEGIN
SELECT COUNT (*) INTO p_retcode
FROM S_GSMRY_DATA_SURVEY
WHERE request_id = p_requestid ;
COMMIT;
RETURN;
END;
Nothing much there. I want to do an insert into a table,
from the procedure later, but I figured that I start with a select count since it's simpler.
When I ran the Php code, I get the following:
144937
Parse was successful
Requestid Bind Successful
Returnval Bind Successful
Result = 0
Exec Returned FALSE
Error = ORA-00000: normal, successful completion -- while
processing OCI function OBNDRA
ErrorCode = 0
Error Executing
I listed the messages on separate lines for clarity. I don't understand why it parses and binds o.k. but the exec returns false.
Thanks again in advance for your help. Have a great day.
Regards,
Rudiretcode=`echo $?`is a bit convoluted. Just use:
retcode=$?I see no EOF line terminating your input. Your flavour of Unix might not like that - it might ignore the command, though I'd be surprised (AIX doesn't).
replace the EXEC line with :
select 'hello' from dual;
and see if you get some output - then you know if sqlplus commands are being called from your script. You didn't mentioned whether you see the banner for sqlplus. Copy/paste the output that you get, it will give us much more of an idea. -
Web service call problem with complex types input
We are trying to call a web service and pass as parameter
some complex types. When invoking the web service everything works
well on flex side, but on the server side the input parameters we
get from flex are not correct - complex type is removed and the
elements of the complex type are sent. See the example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:WebService id="ws_id" wsdl="link" useProxy="false"
fault="wsFault(event)">
<mx:operation id="op_id" name="op"
result="wsResult(event)">
<mx:request>
<parameters>
<parameter1>{value1}</parameter1>
<parameter2>{value2}</parameter2>
<parameter3>{value3}</parameter3>
<parameter4>
<parameter4_1>{value4_1}</parameter4_1>
<parameter4_2>{value4_2}</parameter4_2>
<parameter4_3>{value4_3}</parameter4_3>
</parameter4>
</parameters>
</mx:request>
</mx:operation>
</mx:WebService>
</mx:Application>
on server side we get this:
<parameters>
<parameter1>{value1}</parameter1>
<parameter2>{value2}</parameter2>
<parameter3>{value3}</parameter3>
<parameter4_1>{value4_1}</parameter4_1>
<parameter4_2>{value4_2}</parameter4_2>
<parameter4_3>{value4_3}</parameter4_3>
</parameters>
Instead of :
<parameters>
<parameter1>{value1}</parameter1>
<parameter2>{value2}</parameter2>
<parameter3>{value3}</parameter3>
<parameter4>
<parameter4_1>{value4_1}</parameter4_1>
<parameter4_2>{value4_2}</parameter4_2>
<parameter4_3>{value4_3}</parameter4_3>
</parameter4>
</parameters>
Any idea how is it possible to send complex type as web
service input from flex ?Hi,
I also have similar type of problem where I need to invoke a Web service with Complex input parameters.
I followed Susan's blog but I stuck at a point where methos getItem is created.
Can anyone tell me how to get that method for my requirement.
If possible can you guys share your solutions here.
Thanks in advance. -
Problem in calling oracle procedure from java
Oracle procedure with the following parameters.
CREATE OR REPLACE PROCEDURE CREDITED_TO_STORE_INSERT (P_CUST# IN NUMBER,
P_INV_DATE IN DATE,
P_MEMO# IN NUMBER,
P_SESS_ID IN VARCHAR2 ) IS
BEGIN
/*.........Procedure Body with select and insert statements there no OUT or return variable/value......*/
END;
Now i am calling this procedure with the java code in java.
public boolean execProcedure(String storeNo, String invoiceDate, String claimNo, String sessionID) throws SQLException {
CallableStatement cstmt = null;
java.sql.Date invicDate = this.StringToDate(invoiceDate);
try
cstmt = conn.prepareCall("{call WEBUSER.CREDITED_TO_STORE_INSERT(?,?,?,?,?,?)}");
cstmt.setInt(1, Integer.parseInt(storeNo));
cstmt.setDate(2, invicDate);
cstmt.setInt(3, Integer.parseInt(claimNo));
cstmt.setString(4, sessionID);
cstmt.execute();
catch (Exception e)
System.out.println (e);
} // catch (Exception e)
finally
try
cstmt.close();
catch (Exception ex)
} // catch (Exception ex)
} // finally
return true;
But it will return the following exception.
[STDOUT] java.sql.SQLException: Missing IN or OUT parameter at index:: 5
i don't know why :( please help me ...your procedure has 4 parameters but in the prepared statement you define 6 placeholders
-
How to Call complex data type in ALBPM
Hi,
I want to call webservice. I took wsdl from other system(example MessageBroker or OSB).Now that wsdl file is referring to internal xsd.
The input format of wsdl(webservice) is just like:-
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:POCInput xmlns:m="http://www.pocforvineet.com/donebysudarshanhebbar/s3/techodc">
<m:PDMID>String</m:PDMID>
<m:CompanyNumber>String</m:CompanyNumber>
</m:POCInput>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
now when i call that webservice in OBPM after following the steps(catalog->new Module->webservice-> browse wsdl file and import it) & drag & drop method to call
<b>getSuccess(POCMessageSetService, pocInput : null, out pocOutput : pocOutput) //method to call
pocMessageSetService = CallingComponent.CallingSud.POC_WSDLService.POCMessageSetService(endPoint : "http://localhost:7001/WebPOC/CallALSB") </b>
It is expecting xmlObject or java object in <b>pocInput</b>
now how to call this complex type in OBPM.
Please help me out in this case.
Thanx in advance
Regards,
Vinny1. Have you created an XSD for the XML? (there is a free conversion utility on http://www.hitsw.com/xml_utilites/ that does this)
2. Have you tried cataloging the XML's XSD into the catalog? (create a new module in the catalog -> right mouse click the module -> in "Catalog Component" -> "XML Schema")
3. Have your right moused clicked the newly created XML that you just cataloged -> clicked "Create Heir" to create a new object that has the "load()" method?
Dan -
Procedure runs in SQL Plus, but not when called from my Oracle Form
Hi. I have this code to send an email alert as the user updates a record on my base table from my Oracle Form. I use dbms_scheduler so that it's submitted as a background job and so the email processing does not delay my Oracle Form from saving quickly. If I submit this code in SQL Plus it executes and I receive the email as expected.
begin
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationConflict_Notify (62547, ''01-SEP-11'', ''02-SEP-11''); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end;However if I submit this code from a Post-Update trigger in my form the code runs without error, but my email is never received (the same parameter values would be passed to this trigger):
begin
-- Submit the email notification in the background so as to not slow down the screen while saving.
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationConflict_Notify (:dropper_vacations.dropper_id, :dropper_vacations.begin_dt, :dropper_vacations.end_dt); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end; Any ideas why this might be happening?Wow, so I changed the two procedures so that I'm only passing in one number parameter and one char parameter...
CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) ISIf I execute it like this it works and I get the email:
TTMS.job_vacationconflict_notify(62547, 99999);or like this it works and I get the email:
TTMS.job_vacationconflict_notify(62547, '99999');But if I execute it like this (I get no errors) the email is not sent:
TTMS.job_vacationconflict_notify(62547, 'ababa');So this problem really has nothing to do with date formats. It seems to have to do with whether parameter two has characters in it!!! What the heck.
Any ideas on this?
Here is the procedure I'm calling:
CREATE OR REPLACE procedure TTMS.job_vacationconflict_notify (p_dropper_id number, p_other char) IS
begin
dbms_scheduler.create_job (
job_name => 'IMMEDIATE_JOB',
job_type => 'PLSQL_BLOCK',
job_action => 'begin TTMS.dropperVacationemailurl_new ('||p_dropper_id||','||p_other||'); end;',
number_of_arguments => 0,
start_date => sysdate +1/24/59, -- sysdate + 1 minute
enabled => TRUE,
auto_drop => TRUE,
comments => 'Immediate, one-time run');
end;
/And the above procedure is calling this procedure which should be sending the email alert:
CREATE OR REPLACE PROCEDURE TTMS.dropperVacationEmailURL_new (in_dropper_id number, in_other char) IS
myguid varchar2(15):=null;
pcm_contact varchar2(3):=null;
guid_contact varchar2(15):=null;
conflict_cnt number(8):=0;
-- Various declarations
PSENDER VARCHAR2(200); -- From
PRECIPIENT VARCHAR2(200); -- To
P_CC_RECIPIENT VARCHAR2(200); -- CC
P_BCC_RECIPIENT VARCHAR2(200); -- BCC
PSUBJECT VARCHAR2(200); -- Subject
PMESSAGE VARCHAR2(6000); -- Message Body
PPARAMETER NUMBER; -- Parameter Value
guid_valid varchar2(15); -- Used to grab the validation value of
-- Grab name details of e-mail targets
cursor targets is
select guid, initcap(first_name) first_name, initcap(first_name)||' '||initcap(last_name) fullname
from pwc_employee
where upper(guid) = upper(guid_contact);
BEGIN
select count(*)
into conflict_cnt
from dropper_bundle_assign
where
dropper_sched = in_dropper_id and
trunc(sched) <> '31-DEC-29' AND
trunc(sched) between '01-SEP-11' and '02-SEP-11' and
trunc(sched) > trunc(sysdate);
select distinct pcm
into pcm_contact
from dropper_bundle_assign
where
dropper_sched = in_dropper_id and
trunc(sched) <> '31-DEC-29' AND
trunc(sched) between '01-SEP-11' and '02-SEP-11' and
trunc(sched) > trunc(sysdate);
select guid
into guid_contact
from pwc_employee
where initials = pcm_contact;
-- Ensure required parameters have been passed
if guid_contact is not null
and in_dropper_id is not null then
Begin
select guid
into guid_valid
from pwc_employee
where upper(guid) = upper(guid_contact);
Exception
when no_data_found then
raise_application_error(-20000,'Invalid Recipient. Please check the employee table. Please try again.');
End;
-- In the event there are multiple targets then we will loop thru and send individual emails
for thisone in targets loop
PSENDER := lower(user)||'@us.ibm.com';
PRECIPIENT := lower(thisone.guid)||'@us.ibm.com';
P_CC_RECIPIENT := lower(thisone.guid)||'@us.ibm.com';
P_BCC_RECIPIENT := 'ssbuechl'||'@us.ibm.com';
PPARAMETER := TO_NUMBER(lower(in_dropper_id));
PSUBJECT := 'TEST: Dropper Vacation '||in_other||' Conflict Notification for dropper '||in_dropper_id||' - Action Required';
PMESSAGE := thisone.first_name||'-<br><br>There is an induction conflict due to a new or updated dropper vacation.<br><br>Click here to the dropper''s vacation conflicts: <u><a href="http://9.35.32.205:7777/forms/frmservlet?config=TTMSMENU&form=dropper_vacations&otherparams=p_dropper='||PPARAMETER||'">Dropper Id: '||PPARAMETER||'</a></u> (note: use your Oracle credentials when prompted for log-on information).<br><br>Thanks.';
SEND_MAIL ( PSENDER, PRECIPIENT, P_CC_RECIPIENT, P_BCC_RECIPIENT, PSUBJECT, PMESSAGE ); -- Procedure to physically send the e-mail notification
end loop;
else
raise_application_error(-20001,'Recipient and Parameter Value are required. Please try again.');
end if;
exception
when no_data_found then
raise_application_error(-20002,'Note: Email will not be sent because no PCM was identified as the manager or the PCM does not have a record in the Employee table. See ITS for assistance.');
when too_many_rows then
raise_application_error(-20003,'Note: Email will not be sent because multiple PCMs manage this dropper. Please notify each PCM manually.');
END dropperVacationEmailURL_new;
/Edited by: sharpe on Aug 17, 2011 4:38 PM
Edited by: sharpe on Aug 17, 2011 5:03 PM -
Help in calling sql loader and an oracle procedure in a script
Hi Guru's
please help me in writing an unix script which will call sql loader and also an oracle procedure..
i wrote an script which is as follows.
!/bin/sh
clear
#export ORACLE_SID='HOBS2'
sqlldr USERID=load/ps94mfo16 CONTROL=test_nica.ctl LOG=test_nica.log
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
sqlplus USERID=load/ps94mfo16 << EOF
EXEC DO_TEST_SHELL_SCRIPT
it is loading the data in to an oracle table
but the procedure is not executed..
any valuable suggestion is highly appriciated..
Cheersmultiple duplicate threads:
to call an oracle procedure and sql loader in an unix script
Re: Can some one help he sql loader issue. -
Please help to call oracle procedure with out paramter from shell script
Hi
I want to call a process with out parameter from shell script. I am calling process in shell script in below way
function Process_loads {
( echo 'set serveroutput on size 1000000 arraysize 1'
echo "set pagesize 0 term on verify off feedback off echo off"
echo "BEGIN"
echo " dbms_output.put_line('Before Calling The package'); "
echo " x ( '$1', '$2', '$2', '$4', '$5', '$error_code'); "
echo " dbms_output.put_line('After Calling The package'); "
echo "EXCEPTION "
echo " WHEN OTHERS THEN "
echo " dbms_output.put_line('BIN_LOAD_ERROR' || SQLERRM); "
echo " ROLLBACK;"
echo "END;"
echo "/" ) | sqlplus -s $USER/$PASSWORD@$SID
Here $error_code is out paramter. All varaibles passed in process are declared with export command.
When executing .sh it gives below error
"sh ERROR at line 3: ORA-06550: line 3, column 99: PLS-00363: expression '' cannot be used as an assignment target ORA-06550: line 3, column 3: PL/SQL: Statement ignored".
Please help to get rid from this error or please suggest how to call a oracle procedure with out paramter from unix shell script.
Thanks in advanceYou can try this:
From sql*plus
SQL> ed
1 create or replace procedure my_proc(p_id in int, p_result out int)
2 as
3 begin
4 select 10 * p_id
5 into p_result
6 from dual;
7* end my_proc;
SQL> /
Procedure created.
SQL> set serveroutput on
SQL> declare
2 v_r int;
3 begin
4 my_proc(10,v_r);
5 dbms_output.put_line(v_r);
6 end;
7 /
100
PL/SQL procedure successfully completed.
from bash:
testproc.sh:
#!/bin/bash
(echo 'set serveroutput on';
echo 'declare';
echo 'v_r int;';
echo 'begin';
echo 'my_proc(10,v_r);';
echo 'dbms_output.put_line(v_r);'
echo 'end;';
echo '/';) | sqlplus -s u1/u1
Console:
oracle@mob-ubuntu:~$ chmod u+x testproc.sh
oracle@mob-ubuntu:~$ ./testproc.sh
100
PL/SQL procedure successfully completed.With kind regards
Krystian Zieja -
Calling Oracle Procedure in Parallel
Is it Possible to call two Oracle Procedures in Parallel.
Begin
call Procedure a;
call Procedure b;
end;
When I will run the above block, I want that Oracle will call the Procedure a and then oracle will not wait for the procedure a to complete, Oracle will call procedure b, The procedure a and b both are called in parallel.
Is it possible ? If possible How ?
Thanx in advance.Please check the link -
http://www.devx.com/dbzone/10MinuteSolution/20902/1954?pf=trueh
http://forums.oracle.com/forums/search.jspa?threadID=&q=parallel+execution+of+procedure&objID=f75&dateRange=all&userID=&numResults=15
Regards.
Satyaki De. -
How to call Oracle Procedure into ODI
Hi,
I'm using ODI 10g.
Before executing the interface in a package i wanted to place my Procedure.
I created following procedure in d/b (target)
CREATE OR REPLACE PROCEDURE TEST_MY_NEW_PROCE
AS
BEGIN
DELETE FROM EMPLOYEE_TABLE
WHERE EMPLOPYEE_ID LIKE 'P%';
COMMIT;
END;
The Procedure is working fine in target database.
Now, before executing my interface i would like to run this procedure in my package. So, can some one please help me how to call this oracle procedure (Created in Target schema) into ODI and run this.
thank you.Hi GRK,
You can create an ODI procedure, add a single step, choose Oracle as Technology and your target schema.
Then just call it through a pl/sql block :
BEGIN
TEST_MY_NEW_PROCE;
END;Then drag this ODI procedure in your package.
Regards,
JeromeFr
Maybe you are looking for
-
Customer exit variable - internal table in BEX
Hi, i am running a report and using variables in it. The report runs over a info cube. There are few challenges in it. One of the variable is posting date, and when user enters posting date i need to negate it with current system date. If the negated
-
Want To Know The Name OF Company Table
In Administration -> Choose Company, It gives me the list of all Company Name,Database Name,Version etc . I Want to know the Table Name which has all information about company name and all. Regards
-
Installing Conversion Agent: warning message
Hi, When installing the Conversion Agent I get a warning: All corrective software packages for SAP NW 7.0 are only available via Maintenance Optimizer in SAP Solution Manager. Does anyone know why this is? Rgs, Alice
-
"music" is missing in automatic downloads
Under Settings-> Store -> Automatic Downloads, there are normally 3 items: Music, Apps, Books. When I went to turn "Music" on, it literally disappeared right before my eyes. Now there is only "apps" and "books". Why did this disappear? What is this
-
Blurred pics after upgrade to 9.4 and OS X 10.8.2
Hi, last night I upgraded to OS X 10.8.2 and iPhoto 9.4. Everything seemed to have worked fine, except that now some of the pics in the iPhoto library appear blurred. Not all of them, and not all the time. Closing and reopening iPhoto fixes the issue