Calling stored procedure in Oracle forms

I have a stored procedure in Oracle which is declared as follows in the package
SFCS1.Company_Selection(O_Cursor IN OUT T_Cursor, cls IN Varchar2);
Where T_Cursor is defined as a Ref Cursor
From the Oracle forms I'm using the following code
SFCS1.Company_Selection(A,my_cls);
go_block('Block50');
Execute_Query;
I get the error message "FRM40505:Oracle Error: Unable to Perform Query". If I hardcode the value of my_cls in the query it runs properly. Any solutions will be really helpful
Further to this, I want to put the single quotes around a value (for eg. 'A') from a variable. For instance I'm getting a value from my_cls and for the output I want to surround it with the single quotes, can somebody tell me how to do it.
Thanks in advance

This is a bit of a roundabout way to do it? Try setting up the block data source as procedure and set the values in the property palette of the data block.
e.g.
Query Data Source Type = Procedure
Query Data Source Name = SFCS1.Company_Selection
Query Data Source Columns = (Whatever columns/items you have in your datablock)
Query Data Source Arguments = Argument names are your ref cursor and your variable.
Check out basing data blocks on Ref Cursors.
HTHs
L :-)

Similar Messages

  • Need sample source code for calling stored procedure in Oracle

    Hi.
    I try to call stored procedure in oracle using JCA JDBC.
    Anybody have sample source code for that ?
    Regards, Arnold.

    Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
    I have the Procedure defined as below in the SFCS1 package body
    Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
    BEGIN
    Open O_Cursor FOR
    SELECT CompanyId, CompanyName
    FROM Company
    WHERE CompanyProvince IN ('AL','AK');
    END Company_Selection;
    In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
    At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
    DECLARE
    A SFCS1.T_Cursor;
    BEGIN
    SFCS1.Company_Selection(A);
    go_Block ('Block36');
    The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause.

  • Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)

    Hi All,
    We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
    Database is Oracle.
    *Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
    Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
    If both are equal, then
         if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
         else  if the field: 'qq' in YY table equals to "Modify"  then take the data from the view table: 'Modify_View'.
    Finally, We need to archive the selected data from the respective view table.*
    From each table, data will come differently, means with different field names.
    I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
    But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
    Is there any way other than Stored Procedure?
    How to handle Data Types as data is coming from two different tables?
    Can we create one data type for two tables?
    Is BPM required for this to collect data from two different tables?
    Can somebody guide me on how to handle this?
    Waiting eagerly for help which will be rewarded.
    Thanks and Regards,
    Jyothirmayi.

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • How to call database procedure in oracle forms

    Hi,
    Can anyone describe me that how I'll call database procedure in oracle forms (6i,10g)?
    Thanks in Advance.
    Baloch

    Hi Francois,
    As I created a procedure in database as below
    create or replace procedure For_table (tbl_of in number,st_pnt in number,en_pnt in number) is
    begin
    for i in st_pnt..en_pnt loop
    dbms_output.put_line(tbl_of||'*'||i||'='||tbl_of*i);
    end loop;
    end For_table;
    The above procedure is working fine when I'm using PL/SQL. I call the above procedure as
    begin
    For_table(3,5,20);
    end;
    but nothing happen
    Thanks in Advance.
    Baloch

  • Calling stored procedures from oracle ADF

    hi all ,
    is there any way to call stored procedures form oracle ADF...... kindly help me....

    Thanks Dear ! i also got it from JDeveloper Help with topic About Using Stored Procedures
    and it is very brief with code and example...... and the link you forward to me is very valuable for me ... Thanks again.....

  • Calling Stored procedure in Oracle 11g from Oracle forms developer 6i

    We have Oracle 11g (11.1.0.7.0 ) database (64 bit) installed on Windows Server 2008.
    In this database, we have stored procedure ABC(arg1) which is accesing a table in another instance through DB LINK. If we EXECUTE this procedure from SQL/TOAD. It runs successfully and generates the desired output.
    If we write the contents of the stored procedure in the PROGRAM UNIT / ANY TRIGGER in FORM 6i then also, It runs successfully and generates the desired output.
    It is also mentioned, that if we try to use any table in the same instance (and not through DBLINK) then it works fine.
    However, if we try to call this stored procedure (which is  accesing a table in another instance through DB LINK) from  ORACLE FORMS  6i  in WHEN-BUTTON-PRESSED trigger then the FORM BUILDER gets hanged while compiling the form developed in FORMS 6i.
    Please provide a solution to this problem.
    THANKS IN ADVANCE.
    Hemant Singh.
    Asstt. Manager(IT)
    Software development team.

    Forms 6i was never meant to run against a 11g database, this was not tested and is also not supported.Well, that is not completely true. Developer 6i is supported against a 11g database, but only for Oracle Apps R11. That means that for most other customers (not Apps) Forms 6i will work against an 11g database. However, only Apps R11 is supported, and patches are only created specifically for Apps. We are also running Forms 6i against an 11g database without (well, minor) problems.
    In this case, you need to find a solution. You can try to put the stored procedure in a package. The package body, with the reference to the remote table, will be hidden from Forms this way.

  • Help: stored procedure for oracle forms

    Hi,
    I am working on a form with data block based on stored procedures. Here is the question:
    On a data block based on simple query, where insert a new record is taking care of by oracle form. That is create_record will do the job.
    When the data block is based on stored procedures, select, update, insert and delete will have to based on the data block created by the ref curcor. How to call the stored procedure from form to create a new record?
    I attempted to write something like:
    PROCEDURE sample_insert
    data_block IN OUT some_refcurcor) IS
    BEGIN
    insert into some_table values
    (data_block.field1, data_block.field2.....);
    commit;
    END;
    I am not quit sure how this works, as would create_record buildin will work to clean up the FORM data block and allow user to enter data and when and how the sample_insert will be called to make this work? Or how the same effect will work out as none stored procedure would do. New data eventually get into the designated table.
    Any suggestions are greatly appreciated.
    Jimmy
    Correction: (data_block IN OUT some_refcurcor) should be (data_block IN OUT some_table) and some_table is a record type etc..
    Message was edited by:
    WJH

    Hello,
    there are two kinds of output from a stored procedure which can be used in a forms block:
    - ref cursor
    - table of records
    The easiest way is to use a ref cursor. Use a strongly typed one,
    so that you can see the columns in the block wizard.
    A table of records is used when you also want to insert, update and so on.
    There is a not on metalink note for this ( 66887.1 ).
    Bernd

  • Calling a procedure from Oracle Forms with OUT parameter

    HI,
    Can anyone tell me in detail how to call a procedure with OUT parameters from Oracle Forms 6i ?
    Thanks in advance.

    Hello,
    Just provide the out parameter in the call:
    Declare
      amount   number; -- OUT number argument populated by the procedure
    Begin
      -- call the X procedure --
      x( amount ) ;
    End;Francois

  • Calling stored procedure From Oracle BAM 11g Reports ???

    Is it possible to pass user prompt value from oracle bam11g report  to the stored procedure  as parameter and get data from database and display report on that? 
    Reagrds,
    Ravi yadav

    Hi Gopal,
    Thank you for your reply.
    >Is there any way other than Stored Procedure?
    Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
    I need to select the data from different tables based on some conditions. Let me simplify that.
    Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
    How can we meet this by configuring sender adapter with ATP?
    ================================================================================================
    >How to handle Data Types as data is coming from two different tables?
    If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
    we need to take data only from one table at a time. It is not join of two tables.
    ================================================================================================
    Thanks,
    Jyothirmayi.

  • Calling stored procedure in OCCI

    Hi, Guys.
    I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters.
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Here is the 2 lines that make the problem.
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    I can't access Type::OCCIINT and Type::OCCIString.
    I tried and Type::OCCISTRING but without any result.
    Can you help me?
    This is the all code i use:
    Environment *env = Environment::createEnvironment ( Environment::DEFAULT );
    Connection *conn = env->createConnection ( user, pass, osid );
    Statement * statement = conn->createStatement ( query );
    ResultSet * result = statement->executeQuery ( query );
    result->setCharacterStreamMode ( 2, 10000 );
    statement->setSQL ( "BEGIN tracetst.get_tst_moduls ( :1, :2, :3 ); END:" );
    int if_false;
    string __result;
    statement->setString ( 1, "116714020010" );
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    statement->executeUpdate();
    if_false = statement->getInt (2);
    /* Set the 1,2 args into err_result and modules. The action is only with these */
    err_result = if_false;
    __result = statement->getString (3);
    cout << if_false;
    cout << __result;
    //printf ( result );
    //statement->executeUpdate ( query );
    env->terminateConnection ( conn );
    Environment :: terminateEnvironment ( env );
    While compiling I have an error message.Here it is :
    trace.cpp: In member function `const char* oracle_io::get_data()':
    trace.cpp:668: error: `oracle::occi::Type' is not an aggregate type
    Tha is the line adn the next line is same :
    statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
    statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
    How to call the procedure corectly?
    Depend on Oracle manual everything is fine but as we see that is not.
    Thanks in advance.
    P.S. I would like to thanks to Amogh for helping me before.

    Did you remove the colon after END ?
            Environment *env = Environment::createEnvironment(Environment::OBJECT);
            Connection *conn = env->createConnection("scott","tiger","inst1");
            Statement *stmt;
            int num; string name;
            try
                    stmt=conn->createStatement();
                    stmt->setSQL ( "BEGIN scott.test ( :1, :2, :3 ); END;" );
                    stmt->setString ( 1, "11" );
                    stmt->registerOutParam(2, OCCIINT,sizeof(num));
                    stmt->registerOutParam(3, OCCISTRING,sizeof(name));
                    stmt->execute();
                    num=stmt->getInt(2); name=stmt->getString(3);
                    cout<<num<<"   "<<name<<endl;
            catch (SQLException &ex)
                    env->terminateConnection(conn);
                    Environment::terminateEnvironment(env);
                    cout<<ex.getMessage();
            env->terminateConnection(conn);
            Environment::terminateEnvironment(env);
    ...Rgds.
    Amogh

  • Calling Stored Procedure with CLOB parameter

    Hi,
    i have one procedure with IN parameter CLOB which is taking xml file and stored in one table column and this table column datatype is also CLOB. And this procedure called by .Net program but problem is when the file will come more than 32KB calling procedure failed. But as i know CLOB can stored up to 4GB data.
    Is that Limitation of oracle or .Net version
    please let me know the solution for that,
    Create Procedure Insert_File(P_XMLFILE IN CLOB)
    as
    begin
    insert into instances
    values(p_xmlfile);
    commit;
    end;
    regards,
    Madan

    Hi Thanks for your reply,
    Actually this procedure called by .net program and the XML file has passed in that parameter which come from some FTP(its inbound) and this files we are storing into above mentioned table.
    Error has come while calling stored procedure Through .net
    Error Details:
    Error calling stored procedure. 0 retry attemps has failed. Error: System.Exception: Error while calling stored procedure on Oracle: INSERT_FILE: System.Data.OracleClient.OracleException: ORA-01460: unimplemented or unreasonable conversion requested

  • SQLException while calling a Stored Procedure in Oracle

    Hi all,
    I am getting this error while calling a Stored Procedure in Oracle...
    java.sql.SQLException: ORA-00600: internal error code, arguments: [12259], [], [
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:207)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:540)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1273)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:780)
    at oracle.jdbc.driver.OracleResultSet.next(OracleResultSet.java:135)
    at StoredProcedureDemo.main(StoredProcedureDemo.java:36)
    The Program is ...
    import java.sql.*;
    public class StoredProcedureDemo {
         public static void main(String[] args) throws Exception {
              Connection con = null;
              ResultSet rs = null;
              Statement st = null;
              CallableStatement cs = null;
              int i;
              try {
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:SHYAM","scott","tiger");
                   System.out.println("Got Connection ");
                   st = con.createStatement();
                   String createProcedure = "create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS"
                             +" Emp_name VARCHAR2(10);"
                             +" CURSOR c1 (Depno NUMBER) IS"
                             +" SELECT Ename FROM emp WHERE deptno = Depno;"
                             +" BEGIN"
                             +" OPEN c1(Dept_num);"
                             +" LOOP"
                             +" FETCH c1 INTO Emp_name;"
                             +" EXIT WHEN C1%NOTFOUND;"
                             +" END LOOP;"
                             +" CLOSE c1;"
                             +" END;";
                   System.out.println("Stored Procedure is \n"+createProcedure);
                   i = st.executeUpdate(createProcedure);
                   System.out.println("After creating the Stored Procedure "+i);
                   cs = con.prepareCall("{call Get_emp_names(?)}");
                   System.out.println("After calling the Stored Procedure ");
                   cs.setInt(1,20);
                   System.out.println("Before executing the Stored Procedure ");
                   rs = cs.executeQuery();
                   System.out.println("The Enames of the given Dept are ....");
                   while(rs.next()) {
                        System.out.println("In The while loop ");
                        System.out.println(rs.getString(1));
              catch (Exception e) {
                   e.printStackTrace();
    Stored Procedure is ...
    create or replace PROCEDURE Get_emp_names (Dept_num IN NUMBER) IS
    Emp_name VARCHAR2(10);
    CURSOR c1 (Depno NUMBER) IS
    SELECT Ename FROM emp WHERE deptno = Depno;
    BEGIN
    OPEN c1(Dept_num);
    LOOP
    FETCH c1 INTO Emp_name;
    EXIT WHEN C1%NOTFOUND;
    END LOOP;
    CLOSE c1;
    END;
    Stored procedure is working properly on sql*plus(Oracle 8.1.5)) editor. But it is not working from a standalone java application. Can anyone please give me a solution.
    thanks and regards
    Shyam Krishna

    The first solution is to not do that in java in the first place.
    DDL should be in script files which are applied to oracle outside of java.
    Other than I believe there are some existing stored procedures in Oracle that take DDL strings and process them. Your user has to have permission of course. You can track them down via the documentation.

  • How to write a PL/SQL stored procedure in Oracle to call Webservice

    Can any one pelase send me a code on how to write a PL/SQL stored procedure in Oracle database to call the Webservice ?
    Thanks,
    Rajesh

    Were you able to solve this problem

  • How to call stored procedure having parameter as oracle type from java???

    Hello,
    I have created following type & stored procedure in oracle. How can i call this stored procedure from my java class?
    I want to pass 2d array to this procedure.
    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE INSERTEMP (pp in tbl_survey)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    END;
    /

    CREATE OR REPLACE TYPE type_survey AS OBJECT ( emp_id number,emp_name varchar(100));
    CREATE OR REPLACE TYPE tbl_survey AS VARRAY(100) OF type_survey;
    CREATE OR REPLACE PROCEDURE APP_DATA.INSERTEMP (pp in tbl_survey,result out varchar)
    IS
    BEGIN
    FOR I IN pp.FIRST .. pp.LAST
    LOOP
    INSERT INTO SURVEY (id) VALUES (pp(I).emp_id);
    END LOOP;
    result:='done';
    END;
    public static void passArray() throws SQLException
         Connection conn=null;
         try{
              conn=getOracleConnection();//this method returns connection object
         catch (Exception e)      
              e.printStackTrace();
         String[][] val=new String[2][2];
    *     val[0][0]="1";*
    *     val[0][1]="aaa";*
    *     val[1][0]="2";*
    *     val[1][0]="bbb";*
    StructDescriptor desc1=StructDescriptor.createDescriptor("TYPE_SURVEY",conn);
    STRUCT p1struct1 = new STRUCT(desc1,conn,_val_); *//showing error at this line*
    ArrayDescriptor arraydesc = ArrayDescriptor.createDescriptor("TBL_SURVEY",conn);
    ARRAY array = new ARRAY(arraydesc,conn,*p1struct1*);
    CallableStatement cstmt = conn.prepareCall("{ call INSERTEMP(?,?)}");
    cstmt.setObject(1,array);
    cstmt.registerOutParameter(2, OracleTypes.VARCHAR);
    cstmt.execute();
    String res=cstmt.getString(2);
    System.out.println(res);
    in the above java code, I have passed 2d array of string to STRUCT constructor and passed STRUCT object i.e. p1struct1  to ARRAY constructor. is it correct? that means @bottom line, I want to pass val array to my stored porcedure. How can i do this? above code is showing following error......
    Exception in thread "main" java.sql.SQLException: Fail to convert to internal representation: [Ljava.lang.String;@146c1d4
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toNUMBER(OracleTypeNUMBER.java:540)
         at oracle.jdbc.oracore.OracleTypeNUMBER.toDatum(OracleTypeNUMBER.java:54)
         at oracle.sql.StructDescriptor.toOracleArray(StructDescriptor.java:717)
         at oracle.sql.StructDescriptor.toArray(StructDescriptor.java:1375)
         at oracle.sql.STRUCT.<init>(STRUCT.java:159)
         at com.flologic.ArrayDemo.passArray(ArrayDemo.java:29)
         at com.flologic.ArrayDemo.main(ArrayDemo.java:57)

  • Calling Stored procedure from Forms 6i

    Dear all,
    I have a stored procedure having INand INOUT parameters. I need to call it from Forms 6i triggers. Will you please tell me the syntax for calling stored procedure and stored function from Forms 6i and report 6i.
    Saibaldas
    [email protected]

    Just the same as for a local procedure, the only restrictions concern package public variables which are not visible from client side PL/SQL, and you probly want to keep the interfaces simple as client side PL/SQL (e.g. the Forms and Reports engines) don't support the same range of datatypes that the database does.

Maybe you are looking for

  • Trying to install a second hard drive on a G4/433Mhz

    Hello, I have a friend that has a G4. She bought a Seagate 400GB hard drive that she wants to use. I warned her that it could be done, but the speed would be affected, so I bought a Acard 6280M ATA/133 PCI card. After installation, the G4 boots with

  • If your ipod is stolen or lost can you still get back the photos?

    All i really need is the photos!!!

  • Error message "397819" for a Discoverer report

    Please assist me,When I am opening a particular Discoverer report I am getting a error message as "397819" .What can be the reason and how to resolve it? I am giving the system details: Oracle Database 11g Enterprise Edition release 11.2.0.1.0 Oracle

  • Trouble moving from JDev 3.0 to 3.1.1.2

    Hi all, I am trying to connect to an OLite 3.6 database within my Java code by using a connection string with a relative path name for the DATADIRECTORY location. I can do this through JDeveloper 3.0 and from the command line with JDK 1.1.8 (I need J

  • 1119 - ERROR - Please Help

    Please help me with this.. I am getting the following error -- 1119: Access of possibly undefined property result through a reference with static type mx.rpc.http.mxml:HTTPService.. The code i am using is as follows.. I am getting the the error in th