StoredProcedure outParameters oracle

Hi, I have a java project where I try to obtain a data type from a Oracle Stored Procedure.
My problem is when I recive the Map (the Map is returned by execute method from StoredProcedure of Spring), the object I have received is a * $Proxy3 * Object and I don't know how to obtain my datas:
In the Oracle data base I have this package:
CREATE OR REPLACE PACKAGE PACKAGE1 AS   TYPE ref_cur IS REF CURSOR;     PROCEDURE myprocedure (name in varchar2, stock_cursor in out ref_cur);   END PACKAGE1; / CREATE OR REPLACE PACKAGE BODY PACKAGE1 AS     PROCEDURE myprocedure (name in varchar2, stock_cursor in out ref_cur)     IS         BEGIN          OPEN stock_cursor FOR 'select                     id,                     name,                     email                   from                     users                  where                   name = '''||name||''' ';                         END myprocedure; END PACKAGE1; /
This procedure can return more of one register. Reason I return a ref cur.
In Java, I try to do this:
1- I have a test class (*Test_Example*), so I can debug step by step.
2- In class (*Example*), called from the test class, is where I define the parameters (in and out) and where I compile and where the execute method is called (Actually the method is running the StoredProcedure class of).
3- I have a class (*GenericProced*) that extends StoredProcedure, where I obtain my datasource.
GenericProced.java
import java.util.Map; import java.util.Properties; import javax.naming.InitialContext; import javax.sql.DataSource; import org.apache.log4j.Logger; import org.springframework.jdbc.object.StoredProcedure; public abstract class GenericProced extends StoredProcedure { public GenericProced(String InitialContextFactory, String providerUrl, String urlPkgPrefixes , String pool, String procedimiento) throws Exception   { super(givemeDatasource ( InitialContextFactory,  providerUrl, urlPkgPrefixes , pool), procedimiento);   }           /* I obtain the datasource from a configuracion file. It runs OK */   public static DataSource givemeDatasource (String InitialContextFactory, String providerUrl, String urlPkgPrefixes , String pool) throws Exception   {     Properties prop = new Properties();     prop.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,InitialContextFactory);     prop.setProperty(InitialContext.PROVIDER_URL, providerUrl);     prop.setProperty(InitialContext.URL_PKG_PREFIXES,urlPkgPrefixes);             //Creamos un contexto y accedemos al recurso.     InitialContext ic = new InitialContext(prop);     DataSource ds = (DataSource)ic.lookup(pool);     return ds;   }// fin método obtenerConexion.       public abstract void definition ();     public abstract Map execute(Object[] objeto); }
Example.java
import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import oracle.jdbc.OracleTypes; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.SqlOutParameter; import org.springframework.jdbc.core.SqlParameter; import es.indra.isia.PL.ProcedimientoGenerico; public class Example extends GenericProced{ private static final String name_proce = "PACKAGE1.myprocedure "; private static final String name = "name"; private static final String result = "result"; public Example(String InitialContextFactory, String providerUrl, String urlPkgPrefixes , String pool) throws Exception{     super(InitialContextFactory,  providerUrl, urlPkgPrefixes , pool, name_proce);     definition(); } public void definition() { setFunction(false); //Because is a procedure declareParameter(new SqlParameter(name, OracleTypes.VARCHAR)); declareParameter(new SqlOutParameter("result", OracleTypes.CURSOR, new RowMapper(){     public Object mapRow(ResultSet rs, int rowNum) throws SQLException {     MyEntity entity = new MyEntity(     rs.getString("id"),     rs.getString("name"),     rs.getString("email")     ); return entity;                     }               }));               compile(); } public Map execute(Object[] theObject) {                   Map datas = new HashMap();               datas.put(name, (String) theObject[0]);                 return super.execute(datas); } }
My RowMapper class MyEntity.javais:
public class MyEntity{     private String id;     private String name;     private String email;     public MyEntity(String id, String name, String email)     {         this.id = id;         this.name = name;         this.email = email;     }     public String toString(  ) {         return "Employee :"+id+", "+ name;     } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this. email = email; } }
Test_Example.java
import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.xml.transform.TransformerException; import Example; public class Test_Example{   public static void main(String[] args){     try{     Test_Example test = new Test_Example();        test.inicioDePrueba("Tom");     }catch (Exception e){       e.printStackTrace();       System.out.println("ERRORRR: "+e);     }   }         public void inicioDePrueba(String name) throws TransformerException, Exception{   Example proc = new Example("org.jnp.interfaces.NamingContextFactory",   "jnp://xxx.xxx.xxx.xxx:xxxx",   "org.jboss.naming:org.jnp.interfaces",   "NPS_POOL_NODE");     // RUN     Object[] objects = new Object[1];     objects[0] = name;         Map resp = proc.execute(objects);           Object obj = (Object)resultado.get("result");   }  }
When I debug the code (with Eclipse), when I run the line Map resp= proc.execute(objects);, It runs OK, and the resp variable is like:
name............................value
resp................................HashMap (id=16)
....[0]...............................HashMap$Entry (id=43)
........key........................*"result"*
........value......................* $proxy3 * (id=47)
This * $Proxy3 * Object, How can I read It?
There is other way to obtain a cursor??
thanks very much.

jesusmgmarin wrote:
Hi, I have a java project where I try to obtain a data type from a Oracle Stored Procedure.
My problem is when I recive the Map (the Map is returned by execute method from StoredProcedure of Spring), the object I have received is a * $Proxy3 * Object and I don't know how to obtain my datas:
In the Oracle data base I have this package:
Why? Or to be more explicit - why is it coded so oddly?
There is other way to obtain a cursor??Via JDBC that requires using Oracle driver specific code.

Similar Messages

  • CALLING ORACLE STOREDPROCEDURES FROM JAVA

    Hi friends
    can anyone tell me how to use storedprocedures of Oracle with swings...
    THANX IN ANTICIPATION
    aLEX

    Please check the following code:
    CallableStatement cstmt = conn.prepareCall("{ ? = call inc_trace()}");
    cstmt.registerOutParameter(1, Types.INTEGER);
    cstmt.executeUpdate();
    trace = cstmt.getInt(1);
    Attention:
    (1) you must use registerOutParameter() to set the return message;
    (2) and, your must use setXXX methods to set parameters.
    Hope this help!
    Jack

  • Problem with Update Select in Stored procedure

    I am using Oracle 8. I'm writing a StoredProcedure and Oracle doesn't like the statement:
    update
    Leave_Coverages
    set
    Rate_Monthly = Rate_Monthly + (select Rate_Monthly from Leave_coverages where Leave_Coverage_ID = 10800)
    where
    Leave_Coverage_ID = 10799;
    When I run the above statement from the command line - I have no problem. This statement in the stored procedure works:
    update
    Leave_Coverages
    set
    Rate_Monthly = Rate_Monthly + 4
    where
    Leave_Coverage_ID = 10799;
    So essentially, I'm having trouble using a select in an update statement, but only in a Stored Procedure.

    Denis,
    This question was answered on this forum in the last week or so but I wasn't quickly able to locate this post.
    Basically Oracle prior to version 9 had an SQL parser and a separate PL/SQL parser. The PL/SQL parser had to be updated each time new features were added to the SQL parser; often it lagged behind so that there were things you could do in plain SQL but weren't supported when using the same SQL in a cursor or directly in PL/SQL (with an INTO clause or RETURNING ... INTO clause).
    From Oracle 9 these two parsers have been rolled into one so that new features introduced into SQL automatically also become available when used from PL/SQL.
    So the answer to your curiousity on whether it will work in 9 or 10 is: if it works in SQL it should work just fine from PL/SQL.
    Cheerio,
    Colin

  • JDBC adapter Commit/Rollback

    Hi Guys, I got a question regarding JDBC adapter auto commit. Hopefully you guys can help me :). Until now, when my XI calling a storedprocedure in ORACLE using JDBC adapter, it will automatically commit the calling. When i see my configuration for the JDBC adapter receiver, the checkbox for Enable Autocommit is thicked. My question is, is there anyway that we handle the commit or rollback ourself. How we can handle that? Is it from the BPM or just from the Configuration.
    Thank you very much in advance for all replies, advices and answer. Cheers guys..

    Hi
    Try this out
    You can programmatically set auto commit to true as in follows
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    // Connect to the database
    // You can put a database hostname after the @ sign in the connection URL.
    Connection conn =
          DriverManager.getConnection ("jdbc:oracle:oci:@", "scott", "tiger");
    // It's faster when auto commit is off
    <b>conn.setAutoCommit (true); </b>
    // Create a Statement
    Statement stmt = conn.createStatement ();
    regards
    krishna

  • Connect Oracle Database with help of sql server storedprocedure

    Hii,
              Is there Any way to connect Oracle Database Using sql server storedprocedure.I want access oracle database and take some data and insert into my sql server database.so is there any way to connect in one
    stored procedure to connect oracle database and take some data and insert in to my sql server database.
    Nikunj Nandaniya

    Hello,
    I am getting below error when i kust Clic k on Test Connection in SSMS:
    TITLE: Microsoft SQL Server Management Studio
    The test connection to the linked server failed.
    ADDITIONAL INFORMATION:
    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
    Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "test".
    OLE DB provider "OraOLEDB.Oracle" for linked server "test" returned message "ORA-12154: TNS:could not resolve the connect identifier specified". (Microsoft SQL Server, Error: 7303)
    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.4000&EvtSrc=MSSQLServer&EvtID=7303&LinkId=20476
    BUTTONS:
    OK
    Can you please guide is there any other setting i need to do after install Oracle Client ?
    Best Regards,
    Tushar Malvi

  • Is it possible to call a oracle packaged storedprocedure through

    Is it possible to call a oracle packaged storedprocedure through
    Deski?
    Also
    Receiving error when creating desktop intelligence report while using a
    stored procedure that retrieves data from globaltemporary table. Error
    message is " Object no longer exists". This same procedure can be
    successfully executed from eitherOracle SQL Plus or Crystal Reports.
    Any ideas , please help?

    It is possible to report off Stored Procedures in BusinessObjects Desktop Intelligence XIR2.  What you need to do is to configure your Stored Procedure as a data source. If you use parameter please make sure  that the default database is set to the database that contains the stored procedure.
    e.g. Click the correct DSN for the stored procedure. Click Configure.Click Next until the Change the default database to option appears.Change the default database to the database that contains the stored procedure.
    I hope this helps,
    Regards,
    Tim

  • How can I monitor Oracle StoredProcedure Running Progress

    How can I monitor Oracle StoredProcedure Running Progress ?
    Because My stored Procedure run a long time ,
    How can I do by calling (parent) program?
    To monitor the StoredProcedure run step ??
    Thanks !
    null

    Franco Lin (guest) wrote:
    : How can I monitor Oracle StoredProcedure Running Progress ?
    : Because My stored Procedure run a long time ,
    : How can I do by calling (parent) program?
    : To monitor the StoredProcedure run step ??
    : Thanks !
    my approge
    create pl proc
    CREATE OR REPLACE PROCEDURE ASIDENTL(
    P_NAME VARCHAR2 ,
    P_ACTION VARCHAR2 )
    IS
    -- @(#) klema 99/06/22 init
    /* Hint
    as sys
    grant select on sys.v_$session to public;
    kot <user> app
    grant execute on ASIDENTL to <user> ;
    begin
    sys.dbms_application_info.set_module( P_NAME, P_ACTION);
    end asidentl;
    snip for long run-code
    for cc in c loop
    n := n + 1;
    asidentl( 'myProc'
    , to_char( n )

  • Unable to send emails to multiple recipients through oracle storedprocedure

    I have the email code working with single email in the To address but I am looping through the table and getting a semicolon separated emails and assining to_mail and I am unabl to send any emails to any users in To address but works for cc_address users. I am getting the following error in the stored procedure when compiling. Please help if any suggestions or any one came accross this issue. Thanks.
    ORA-29279: SMTP permanent error: 501 #5.1.1 bad address @abc.com
    ORA-06512: at "SYS.UTL_SMTP", line 29
    ORA-06512: at "SYS.UTL_SMTP", line 110
    ORA-06512: at "SYS.UTL_SMTP", line 252
    ORA-06512: at "abc_owner.SendMail", line 101
    ORA-06512: at line 10

    900045 wrote:
    I have the email code working with single email in the To address but I am looping through the table and getting a semicolon separated emails and assining to_mail and I am unabl to send any emails to any users in To address but works for cc_address users. I am getting the following error in the stored procedure when compiling. Please help if any suggestions or any one came accross this issue. Thanks.
    ORA-29279: SMTP permanent error: 501 #5.1.1 bad address @abc.com
    ORA-06512: at "SYS.UTL_SMTP", line 29
    ORA-06512: at "SYS.UTL_SMTP", line 110
    ORA-06512: at "SYS.UTL_SMTP", line 252
    ORA-06512: at "abc_owner.SendMail", line 101
    ORA-06512: at line 10when all else fails, Read The Fine Manual
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_smtp.htm#i1002798
    RCPT Function
    This subprogram specifies the recipient of an e-mail message.
    "To send a message to multiple recipients, call this routine multiple times. "
    "Each invocation schedules delivery to a single e-mail address."

  • Passing table as (IN) parameter of an Oracle StoredProcedure

    Hello,
    I want to call an oracle 8.1.7 stored procedure define as:
    CREATE TYPE Commande as object(Name varchar2(64), Type varchar2(2))
    CREATE TYPE CommandeList as table of CommandeRapport
    PROCEDURE Enregistrer (pListe IN CommandeList)
    I can't use oracle.jdbc.driver.OracleCallableStatement
    because I'm using the JDBC pooling of Weblogic (JDBC dataSource that gives me an java.sql.CallableStatement)
    CallableStatement cs =
    connection.prepareCall("{call Enregistrer(?)}");
    what type of cs.set????(1, ????) do I have to use, while I cannot instanciate an "java.qsl.Array" object ?

    I'm not using Weblogic JDBC driver but the Oracle thin driver for 8.1.7.
    I want to use Weblogic JDBC pooling mecanism that gives me "weblogic.jdbc20.rmi.SerialConnection" (not OracleConnection)
    My question is not about driver but "how to pass java array as a SQL ARRAY parameter to a Callable/PreparedStatement, using JDBC 2.0 standard API ?". Oracle specialized JDBC classes allow me to create "oracle.jdbc.ARRAY" objects. I used it for a test and it works fine, but I need JDBC pooling ...
    Please help ... My boss is getting nervous !

  • Looking for some help with using Oracle stored procedures in vb2010

    First off thank you to whoever lends me a hand with my problem. A little background first I am in a software development class and we are currently building our program using VB (I have no experience in this), and Oracle(currently in a Oracle class so I know how to use Oracle itself just not with VB).
    I am using vb2010 express edition if that helps. Currently I have a stored procedure that takes a 4char "ID" that returns a position (ie, salesperson,manager ect). I want to use the position returned to determine what vb form is displayed (this is acting as a login as you dont want a salesperson accessing the accountants page for payroll ect).
    Here is the code I have currently on the login page of my VB form
    Imports Oracle.DataAccess.Client
    Imports Oracle.DataAccess.Types
    Public Class Login
    Dim conn As New OracleConnection
    Private Sub empID_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles empID.Click
    End Sub
    Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
    conn.ConnectionString = "User ID = Auto" & _
    ";Password = ********" & _
    ";Data Source = XE"
    conn.Open()
    Dim sq1 As String = "Return_Position" 'name of procedure
    Dim cmd As New OracleCommand(sq1, conn)
    cmd.CommandType = CommandType.StoredProcedure
    cmd.Parameters.Add(New OracleParameter("I_EmpID", OracleDbType.Char, 4)).Value = Emp_ID.Text
    Dim dataReader As OracleDataReader = cmd.ExecuteReader
    dataReader.Read()
    Dim position As New ListBox
    position.Items.Add(dataReader.GetString(0)) 'were I am getting an error, I also tried using the dataReader.getstring(0) to store its value in a string but its a no go
    If position.FindStringExact("MANAGER") = "MANAGER" Then
    Me.Hide()
    Dim CallMenu As New Menu()
    CallMenu.ShowDialog()
    End If
    LoginBtn.Enabled = False
    End Sub
    I have read the oracle.net developer guide for using oracle in vb2010 and have successfully gotten through the document however they never use a stored procedure, since the teacher wants this program to user a layered architecture I cannot directly store sql queries like the document does, thus the reason I want to use stored procedures.
    This is getting frustrating getting stuck with this having no background in VB, I could easily do this in c++ using file i/o even through it would be a pain in the rear....

    Hello,
    I am calling Oracle 11g stored procedures from VB.Net 2010. Here is a code sample (based on your code) you should be able to successfully implement in your application.
    Please note that you may have to modify your stored procedure to include an OUT parameter (the employee position) if it doesn't have it yet.
    Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
    Dim sProcedureName As String = "Return_Position" 'name of stored procedure
    Dim ORConn as OracleConnection, sConn as String
    Dim sPosition as String, sDataSource as String, sSchema as String, sPWD as String
    Dim cmd As OracleCommand
    'please provide below sDataSource, sSchema and sPWD in order to connect to your Oracle DB
    sConn = "Data Source=" & sDataSource & ";User Id=" & sSchema & ";Password=" & sPWD & ";"
    ORConn = New OracleConnection(sConn)
    ORConn.Open()
    cmd = New OracleCommand(sProcedureName, ORConn)
    With cmd
    .CommandType = Data.CommandType.StoredProcedure
    'input parameter in your stored procedure is EmpId
    .Parameters.Add("EmpID", OracleDbType.Varchar2).Value = Emp_ID.Text
    .Parameters.Item("EmpID").Direction = ParameterDirection.Input
    'output parameter in your stored procedure is Emp_Position
    .Parameters.Add("Emp_Position", OracleDbType.Varchar2).Direction = ParameterDirection.Output
    .Parameters.Item("Emp_Position").Size = 50 'max number of characters for employee position
    Try
    .ExecuteNonQuery()
    Catch ex As Exception
    MsgBox(ex.Message)
    Exit sub
    End Try
    End With
    sPosition = cmd.Parameters.Item("Emp_Position").Value.ToString
    'close Oracle command
    If Not Cmd Is Nothing Then Cmd.Dispose()
    Cmd = Nothing
    'close Oracle connection
    If Not ORConn Is Nothing Then
    If not ORConn.State = 0 Then
    ORConn.Close()
    End If
    ORConn.Dispose()
    End If
    ORConn = Nothing
    If UCase(sPosition) = "MANAGER" Then
    Me.Hide()
    Dim CallMenu As New Menu()
    CallMenu.ShowDialog()
    End If
    LoginBtn.Enabled = False
    End Sub
    If you need further assistance with the code, please let me know.
    Regards,
    M. R.

  • Error while accessing oracle packaged procedure in crystal report./ How to

    Hi,
    When i tried to call a packaged procedure in crystal reports for .net, i am unable to access it.
    i am getting error as 'unknown query engine'
    In that packaged procedure i have a two IN parameters and one OUT TABLE parameter ( which is declared in package specification )
    And when selecting the packaged procedure in crystal report,the wizard shows all the parameters like the IN parameters, and when i just leave it blank. i unable to set into report.
    ie., the OUT table type is shown as IN paramters (Actually it is an output and has field fields in it.)
    And No fields are coming in the Fields Explorer of crystal reports in .net.
    can you provide any help.
    thanks and regards
    Mohan Raj K.
    Actually using vs.net 2005 prof.
    Message was edited by:
    mohanraj_k

    Actually the OUT Parameter type in the stored
    procedure is showing as IN Parameters and asking
    for input values in the crystal report creation
    wizard(while selecting the
    database,connection,storedprocedures/qualifiers).That sounds like a problem on the .net / crystal report creation wizard side of things. Oracle no doubt recognises them as OUT parameters, so it's not Oracle at fault. I would guess the .net stuff is just querying the data dictionary to see what parameters there are rather than differentiating between the INs and OUTs.

  • Call a storedprocedure with CLOB input parameter gives ORA-24811 error

    Hi all,
         I am calling a storedprocedure from VB using ADO and OraOLEDB. Calling stored procedure as mention in OraOLED documentation.
         The procedure accepts a varchar and a CLOB parameter.
         While executing the store procedure its throw an error as “Error while trying to retrieve text for error ORA-24811”
         Then I executed a storeprocedure with only one CLOB out parameter. It is working fine.
         Oracle version is
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    PL/SQL Release 9.2.0.4.0 - Production
    CORE 9.2.0.3.0 Production
    TNS for Linux IA64: Version 9.2.0.4.0 - Production
    NLSRTL Version 9.2.0.4.0 - Production
         O/S: Linux.
         OLEDB version 9.0.1.0.1
         But exact code working with
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    PL/SQL Release 9.2.0.1.0 - Production
    CORE 9.2.0.1.0 Production
    TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
    NLSRTL Version 9.2.0.1.0 – Production
    O/S window 2003
    OLEDB version 9.0.1.0.1
    Can somebody help me on this?
    Regards,
    Mani
    Sample code of stored of stored procedure and VB function pasted below.
    StoreProcedure
    ============
    create or replace procedure xmltext (EmpName varchar2,EmpDetails CLOB)
    as
    begin
    insert into emptmp values (EmpName);
    end;
    VB function
    =========
    Dim Oracon As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim param1 As New ADODB.Parameter
    Dim param2 As New ADODB.Parameter
    Dim empname As String
    Dim empdetails As String
    Set Oracon = CreateObject("ADODB.Connection")
    Oracon.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=testdb;User ID=newtest;Password= newtest;PLSQLRSet=1;SPPrmsLOB=1"
    Oracon.Open
    empname = "Mani"
    empdetails = "<EmpDet/>"
    Set cmd.ActiveConnection = Oracon
    cmd.CommandType = adCmdText
    Set param1 = cmd.CreateParameter("param1", adVarChar, adParamOutput, 10, empname)
    cmd.Parameters.Append param1
    Set param2 = cmd.CreateParameter("param2", adLongVarChar, adParamInput, 10000, empdetails)
    cmd.Parameters.Append param2
    cmd.CommandText = "{ call xmlText(?,?)}"
    cmd.Execute

    code for my procedure testblob is :
    create or replace procedure testblob(bpic blob) as
         val               blob;
         v_rdata          blob;
         v_start          BINARY_INTEGER := 1;
         v_buffer     BINARY_INTEGER := 32767;
    BEGIN
    select pic into val from my_pic where no=1 for update;
    DBMS_LOB.OPEN (val, DBMS_LOB.LOB_READWRITE);
    FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(bpic) / v_buffer)
         LOOP
         v_rdata :=DBMS_LOB.SUBSTR(bpic, v_buffer, v_start) ;
         DBMS_LOB.WRITEAPPEND(val, DBMS_LOB.GETLENGTH(v_rdata), v_rdata);
         v_start := v_start + v_buffer;
         END LOOP;
    dbms_lob.close(val);
    exception
         when others then
              raise_application_error(-20000,sqlerrm);     
    end;

  • Very urgent help needed- Error while passing XML document to Oracle stored

    Hi !
    I have been struggling a lot to call Oracle 9i stored procedure passing Stringbuilder object type from ASP.NET
    I am using Visual Studio 2008 Professional, OS: Windows XP and Oracle: 9.2.0.1.0
    Following is the procedure:
    CREATE or REPLACE PROCEDURE loadCompanyInfo (clobxml IN clob) IS
    -- Declare a CLOB variable
    ciXML clob;
    BEGIN
    -- Store the Purchase Order XML in the CLOB variable
    ciXML := clobxml;
    -- Insert the Purchase Order XML into an XMLType column
    INSERT INTO companyinfotbl (companyinfo) VALUES (XMLTYPE(ciXML));
    commit;
    --Handle the exceptions
    EXCEPTION
    WHEN OTHERS THEN
    raise_application_error(-20101, 'Exception occurred in loadCompanyInfo procedure :'||SQLERRM);
    END loadCompanyInfo ;
    And following is the ASP.net code:
    StringBuilder b = new StringBuilder();
    b.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
    b.Append("<item>");
    b.Append("<price>500</price>");
    b.Append("<description>some item</description>");
    b.Append("<quantity>5</quantity>");
    b.Append("</item>");
    //Here you'll have the Xml as a string
    string myXmlString1 = b.ToString();
    //string result;
    using (OracleConnection objConn = new OracleConnection("Data Source=testdb; User ID=testuser; Password=pwd1"))
    OracleCommand objCmd = new OracleCommand();
    objCmd.Connection = objConn;
    objCmd.CommandText = "loadCompanyInfo";
    objCmd.CommandType = CommandType.StoredProcedure;
    //OracleParameter pmyXmlString1 = new OracleParameter("pmyXmlString1", new OracleString(myXmlString1));
    objCmd.Parameters.Add("myXmlString1", OracleType.clob);
    objCmd.Parameters.Add(myXmlString1).Direction = ParameterDirection.Input;
    //objCmd.Parameters.Add("result", OracleType.VarChar).Direction = ParameterDirection.Output;
    try
    objConn.Open();
    objCmd.ExecuteNonQuery();
    catch (Exception ex)
    Label1.Text = "Exception: {0}" + ex.ToString();
    objConn.Close();
    When I am trying to execute it, I am getting the following error:
    Exception: {0}System.Data.OracleClient.OracleException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'LOADCOMPANYINFO' ORA-06550: line 1, column 7: PL/SQL: Statement ignored at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at Default.Button1Click(Object sender, EventArgs e)
    I understand from this that the .net type is not the correct one, but I am not sure how to correct it. I could not find any proper example in any documentation that I came across. Most of the examples give information on how to read but not how to insert XML into Oracle table by calling Stored Procedure.
    Can you please help me to solve this problem? I hope that you can help solve this.
    Also, can you please give me an example of passing XML document XMLdocument to Oracle Stored procedure.
    In both the cases, if you can provide the working code then it would be of great help.
    Thanks,

    Hi ,
    Additional to the Above error details my BPEL code looks like this:
    <process name="BPELProcess1"
    targetNamespace="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:client="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="bpelprocess1_client" partnerLinkType="client:BPELProcess1" myRole="BPELProcess1Provider" partnerRole="BPELProcess1Requester"/>
    </partnerLinks>
    <variables>
    <variable name="inputVariable" messageType="client:BPELProcess1RequestMessage"/>
    <variable name="outputVariable" messageType="client:BPELProcess1ResponseMessage"/>
    </variables>
    <sequence name="main">
    <receive name="receiveInput" partnerLink="bpelprocess1_client" portType="client:BPELProcess1" operation="process" variable="inputVariable" createInstance="yes"/>
    <invoke name="callbackClient" partnerLink="bpelprocess1_client" portType="client:BPELProcess1Callback" operation="processResponse" inputVariable="outputVariable"/>
    </sequence>
    </process>
    Kindly help if anyone has faced this Issue before.
    Regards,
    Rakshitha

  • Calling a Oracle stored procedure in orchestrator

    I am trying to execute a stored procedure using the query database IP in orchestrator.  I can select data from the oracle db so i know the prereqs are setup correctly but it fails on executing the stored procedure.
    The syntaxe is execute SPNAME('PARAM!','PARAM2')
    The error is 
    Failed, Oracle failure Database error has occurred. ORA-00900: invalid SQL statement
    Oracle query failure, please verify your query syntax is correct.  Verify correct table names and column names etc...
    The SP works fine in sql developer so im pretty sure the syntax is correct unless the Query Database IP needs a different syntax to work.  

    simple as that.  i actually tried something similar since that is how SCOM executes SP but left the execute command in there so it failed and i moved on.  thanks for the reply.  
    Just for reference i went the powershell route and that worked as well but much more complicated then your solution.  for anyone that wants to know the script is 
    $asm = [System.Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") 
    $connectionString = "Data Source=TNSNAME;uid=USERID;pwd=PASSWORD";
    $inputString1 = "PARAMETER INPUT 1";
    $inputString2 = "PARAMETER INPUT 2"
    $oracleConnection = new-object System.Data.OracleClient.OracleConnection($connectionString);
    $cmd = new-object System.Data.OracleClient.OracleCommand;
    $cmd.Connection = $oracleConnection;
    $cmd.CommandText = "SP NAME";
    $cmd.CommandType = [System.Data.CommandType]::StoredProcedure;
    $cmd.Parameters.Add("NAME OF EXPECTED PARAMETER 1", [System.Data.OracleClient.OracleType]::NUMBER) | out-null;
    $cmd.Parameters["NAME OF EXPECTED PARAMETER 1"].Direction = [System.Data.ParameterDirection]::Input;
    $cmd.Parameters["NAME OF EXPECTED PARAMETER 1"].Value = $inputString1;
    $cmd.Parameters.Add("NAME OF EXPECTED PARAMETER 2", [System.Data.OracleClient.OracleType]::VARCHAR2) | out-null;
    $cmd.Parameters["NAME OF EXPECTED PARAMETER 2"].Direction = [System.Data.ParameterDirection]::Input;
    $cmd.Parameters["NAME OF EXPECTED PARAMETER 2"].Value = $inputString2;
    $oracleConnection.Open();
    $cmd.ExecuteNonQuery() | out-null;
    $oracleConnection.Close();
    got help from http://dovetailsoftware.com/clarify/gsherman/2012/05/15/calling-oracle-stored-procedures-using-powershell/

  • Oracle Enterprise Manager Console Sessions

    I do apologize if this is posted in the incorrect location. I have Oracle Enterprise Manager Console open and i'm within instances\Sessions. When I first log in there are 9 total active sessions. 1 is mine with program java.exe which is OEMC. I have a website that calls a stored procedure. It will return either a string or nothing depending on if there is a row in the table. That is the only call that is being made. This executes on page load. As soon as I go to this page and it loads I check OEMC again and now I have 5 new INACTIVE sessions with program w3wp.exe. Why is there 5 when i'm only making 1 call to the database?
    Here is the c# code i'm using on my master page. The page that is calling the master page only has text there is nothing in the code behind for that page.
    OracleParameter pMsg;
    OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["strDB"].ConnectionString);
    OracleCommand command = new OracleCommand("GetMsg", conn);
    command.CommandType=CommandType.StoredProcedure;          
    pMsg = command.Parameters.Add("PMSG", OracleDbType.Varchar2, 4000);
    pMsg.Direction = ParameterDirection.Output;               
    conn.Open();
    command.ExecuteNonQuery();
    string sMsg = Convert.ToString(pMsg.Value);
    if (sMsg.Length > 1)
    litMsg.Text = "** " + sMsg + " **";
    conn.Close();
    conn.Dispose();      
    command.Dispose();
    Thank you for any help

    I think I figured out what is going on. I think it's the connection pooling that is creating these 5 connections. When I turned pooling off it created 1 connection when I was on that page and then when I exited the connection was gone as well. My question now is are these 5 connections for the entire site? Meaning that it will server anyone user to my site?
    If I have an open connection object later on in my code does it skip this process and just go to the connection pool?
    Thanks

Maybe you are looking for