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.

Similar Messages

  • Need Sample source code for Forum in jsp

    Hi..
    Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
    thanx in advance
    kumar

    Hi..
    Please tell me the website which is having the sample source code for simple forum... I have to implement it into my project... kindly help me out...
    thanx in advance
    kumar

  • Creation of DB Adaptert for calling stored procedure in MS SQL server

    Hi,
    I need to create a DB adapter to call a stored procedure in MS SQL Server.
    I have gone thru the thread MS SQL Server database connection
    It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
    Any links to tutorials are welcome.
    Thanks !!.
    Silas.

    Command line is required for stored procedures, if you are using the basic options you don't need to worry.
    (1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
    (2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
    (3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
    (4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
    AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
    While executing this step make sure that your JDeveloper is closed.
    (5) On command prompt go to J Developer folder and execute following command
    jdev -verbose
    This will open JDeveloper.
    (6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
    (7) Select Third Party JDBC
    (8) Specify MS Sql Server User Name, password and Role.
    (9) In connection page specify following
    - Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    - For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
    - Specify URL as following.
    jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
    (10) Go to Test page and test it.
    cheers
    James

  • 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.

  • 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.....

  • Needs sample ABAP code for field routine

    Dear Expert,
    There is a field "Pay Scale Group" in my DSO which stores the data in the format
    AA1/B1/CCC2/DD2/EEE1, A1/BB2/CC2/DDD3/EE2 etc. These data has to be transferred to
    InfoCube where "pay Scale Group" in the InfoCube will store the data like EEE1,EE2 etc.
    I need to write a field routine on the transformation between DSO and Cube.
    Can any one please help me with the sample ABAP code for this scenario.
    Some more examples for better understanding of the requirement:-
    Data in DSO(Source)            Data in Cube(Target)
    ===================            ===================
    AA1/B1/CCC2/DD2/EEE1            EEE1
    AAA1/BB2/CC1/DDD3/EE2           EE2
    A2/BBB2/CC2/DDD3/EEE5           EEE5
    AA2/BB1/C1/DDD3/EE3             EE3
    A3/B1/CC2/DDD1/EE4              EE4
    Many thanks in advance.
    Regards,
    Prakash
    Please do not dump your code requirements in SDN
    Edited by: Pravender on May 18, 2011 11:37 AM

    Hi,
    You can use the following code :
    Suppose the technical name of the field coming from DSO is ZPAY_SGRP.
    And also for example let me take one record, that is ZPAY_SGRP = AA1/B1/CCC2/DD2/EEE1 .
    My assumption is that there will always be 4 '/'.
    In the field routine write the below code
    data: V1(5) type c,
              V2(5) type c,
             V3(5) type c,
              V4(5) type c,
             V5(5) type c.
    data : VAR1 TYPE /BIC/OIZPAY_SGRP.
    split VAR 1  at '/' into V1 V2 V3 V4 V5.
    result = V5.
    V5 will be having the characters after the last '/' .That is V5 = EEE1.
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh
    Edited by: Ashutosh Singh on May 17, 2011 3:53 PM
    Edited by: Ashutosh Singh on May 17, 2011 4:17 PM

  • Wanted: Sample source code for voice recorder

    I've been google searching for some sample source code to implement a voice recorder on my AudioVox 5600. I would like to learn how to read from the microphone and write to my SD card in a standard file format like wav, wma or mp3.
    Can anyone help me understand how to do this?
    Thanks,
    Siegfried

    Basic would be ;
    RESULT_FIELDS -xxx = <SOURCE_FIELDS> -xxx
    you have the source fields as source, and result fields for as the target. In between you can check some conditions as in other routines of transformation.
    BEGIN OF tys_SC_1, shows your source fields ( in your case DSO chars and key figures)
    BEGIN OF tys_TG_1, , shows your result fields ( in your case Cube characteristics)
    Hope this helps
    Derya

  • 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 :-)

  • Best practice for calling stored procedures as target

    The scenario is this:
    1) Source is from a file or oracle table
    2) Target will always be oracle pl/sql stored procedures which do the insert or update (APIs).
    3) Each failure from the stored procedure must log an error so the user can re-submit the corrected file for those error records
    There is no option to create an E$ table, since there is no control option for the flow around procedures.
    Is there a best practice around moving data into Oracle via procedures? In Oracle EBS, many of the interfaces are pure stored procs and not batch interface tables. I am concerned that I must build dozens of custom error tables around these apis. Then it feels like it would be easier to just write pl/sql batch jobs and schedule with concurrent manager in EBS (skip ODI completely). In that case, one could write to the concurrent manager log and the user could view the errors and correct.
    I can get a simple procedure to work in ODI where the source is the SQL, and the target is the pl/sql call to the stored proc in the database. It loops through every row in the sql source and calls the pl/sql code.
    But I can not see how to set which rows have failed and which table would log errors to begin with.
    Thank you,
    Erik

    Hi Erik,
    Please, take a look in these posts:
    http://odiexperts.com/?p=666
    http://odiexperts.com/?p=742
    They could help you in a way to solve your problem.
    I already used it to call Oracle EBS API's and worked pretty well.
    I believe that an IKM could be build to automate all the work but I never stopped to try...
    Does it help you?
    Cezar Santos
    http://odiexperts.com

  • Syntax for calling Stored procedures?

    Seems straightforward but I just can get the syntax.
    Here's the procedure defined in SQL
    CREATE Procedure usp_InsTest
    @title varchar(150),
    @length int,
    @catid int,
    @date datetime,
    @filename varchar(50),
    @typeid int,
    @desc varchar(2000),
    @statusid int,
    @assign char(1),
    @languageid int = null
    as
    Insert into test(TestTitle,TestLength,TestCatID,TestDate,TestFileName,
    TestTypeID,TestDesc,TestStatusID,TestIsAssigned,
    TestLanguageID)
    values (@title,@length,@catid,@date,@filename,@typeid,@desc,
    @statusid,@assign,@languageid)
    GO
    I have tried a number of ways. What is the correct sytax for calling a stored procedure with variables?

    Here's what I've come up with...
    Connection dbConn;
    Driver d = (Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    String URL = "jdbc:odbc:" + "cms";
    dbConn = DriverManager.getConnection(URL, "sa", "");
    CallableStatement s;
    String x = "{call usp_InsTest(@title,@length,@catid,@date,@filename,@typeid,@desc,@statusid,@assign,@languageid)}";
    Calendar c = Calendar.getInstance();
    s = dbConn.prepareCall(x);
    s.setString(1,TestTitle);
    s.setInt(2,Integer.parseInt(TestLength));
    s.setInt(3,6);
    s.setDate(4,new java.sql.Date(System.currentTimeMillis()));
    s.setString(5,TestFileName);
    s.setInt(6,Integer.parseInt(TestTypeID));
    s.setString(7,"Test Description");
    s.setInt(8,Integer.parseInt(TestStatusID));
    s.setInt(9,Integer.parseInt(TestIsAssigned));
    s.setInt(10,1);
    ResultSet r = s.executeQuery();
    I get
    java.lang.NullPointerException
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setChar(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setString(Unknown Source)
    at CMSBatch.addToDatabase(CMSBatch.java:242)
    at CMSBatch.actionPerformed(CMSBatch.java:312)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    Line 242 is the first setString.
    Is my prepareCall statement correct?

  • Sample source code for fields mapping in expert routine

    Hi All
    Iam writing the expert routine from dso to cube for example I have two fields in dso FLD1,FLD2
    same fields in infocube also ,can any body provide me sample abap code to map source fields to target fields in expert routine,your help will be heighly appreciatble,it's an argent.
    regards
    eliaz

    Basic would be ;
    RESULT_FIELDS -xxx = <SOURCE_FIELDS> -xxx
    you have the source fields as source, and result fields for as the target. In between you can check some conditions as in other routines of transformation.
    BEGIN OF tys_SC_1, shows your source fields ( in your case DSO chars and key figures)
    BEGIN OF tys_TG_1, , shows your result fields ( in your case Cube characteristics)
    Hope this helps
    Derya

  • Sample source code for demo application

    Can you please kindly provide me source code of the demo application, i need both oracle form which is converted in to adf and also converted adf code it using Forms2adf, it will be a great help to making a decison for oracle form migration
    Thank you

    Hi,
    I think this thread accurately lists the available options for evaluation of the forms 2 adf migration.
    How can i test forms2adf generator?
    Regards,
    Ruud

  • ORA-22809 when executing sample source code for purchaseOrder.xsd

    Hello,
    i was trying to execute the sample code given in chapter 5 of Oracle XML DB User's Guide for version 10GR2 (on an Oracle XE db) and i got:
    Error starting at line 1 in command:
    CREATE TABLE purchaseorder_as_column (
    id NUMBER,
    xml_document XMLType,
    UNIQUE (xml_document."XMLDATA"."Reference"))
    XMLTYPE COLUMN xml_document
    XMLSCHEMA "http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd"
    ELEMENT "PurchaseOrder"
    VARRAY xml_document."XMLDATA"."Actions"."Action"
    STORE AS TABLE action_table2
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$))
    ORGANIZATION INDEX OVERFLOW)
    VARRAY xml_document."XMLDATA"."LineItems"."LineItem"
    STORE AS TABLE lineitem_table2
    ((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$))
    ORGANIZATION INDEX OVERFLOW)
    LOB (xml_document."XMLDATA"."Notes")
    STORE AS (TABLESPACE USERS ENABLE STORAGE IN ROW
    STORAGE(INITIAL 4K NEXT 32K))
    Error at Command Line:12 Column:32
    Error report:
    SQL Error: ORA-22809: nonexistent attribute
    22809. 00000 - "nonexistent attribute"
    *Cause:    An attempt was made to access a non-existent attribute of an
    object type.
    *Action:   Check the attribute reference to see if it is valid. Then retry
    the operation.
    The purchaseOrder.xsd schema document has been built by cutting and pasting the various fragments contained in the documentation and can be found at:
    http://www.yocoya.com/temp/purchaseOrder.xsd
    The schema was registered using the following command:
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xmlns.oracle.com/xdb/documentation/purchaseOrder.xsd',
    SCHEMADOC => bfilename('XMLDIR','purchaseOrder.xsd'),
    CSID => nls_charset_id('AL32UTF8'),
    LOCAL => TRUE,
    GENTYPES => TRUE,
    GENTABLES => TRUE);
    END;
    Can someone explain what i am doing wrong or tell if the sample code is flawed?
    Thank you,
    Flavio
    http://www.oraclequirks.com

    Just to close this thread, in the sample xml schema document i linked in my original post, there were some xdb:SQLName annotations against elements LineItems, LineItem, Actions and Action. When such annotations are present, column names and object attributes that would otherwise carry the same name as the xml elements/attributes are completely replaced by the specified strings. This is necessary if, for some reason, the element name contain reserved oracle words (i also hit this problem 15 minutes after resolving my original issue...) or simply because we don't like having case sensitive names.
    In my original CREATE TABLE statement i was attempting to refer to nested elements using the original case sensitive names, but these names had been replaced by LINEITEMS, LINEITEM, ACTIONS and ACTION (in uppercase), hence ORA-22809.
    This was not the only problem afflicting my custom purchaseOrder.xsd, but it was the reason of ORA-22809.
    Eventually I managed to get the custom purchaseOrder schema to work.
    May be i'll come up with some tongue-in-cheek tutorial on my blog one day or another.
    Bye,
    Flavio
    http://www.oraclequirks.com

  • Sample source code for GUI

    hi
    I am fairly new to designing GUI in JAVA . My applicaiton involves a big form with alot of choice list[ around 7 choice list ] which r populated using queries from database and also when an item is selected from the choice list , a query is ran which would refresh the screen with the result of the query ., this query would be based on the items selected in the choice lists.
    I tried implementing it, i was able to populate my choice list with the things i need from the DB using the query . but when i just select anything from the choice list, it would throw me a :
    java.lang.NullPointerException
    I am suprised cause, when i select from one choice list, i wouldnt get this error. Also i have not written any event .
    please help .. really important .... or just suggest me some source code which i can study and learn !!! please ....
    Thanks in advance

    got to http://www.trash.net/~ffischer/admin
    As the GUI is done with swing you will find lots
    of examples.
    I think the DBComboBox wil lgive you some hints...
    ..all source is there as well.

  • 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.

Maybe you are looking for

  • Error execute report in R12

    Hi all, I think I better change this question into a sharing because I'd solved my problem :p. Below is my first post in this thread before I found the solution : I hoped I put this in the right forum. Before I ask the question, here are my environme

  • Is Time Capsule the only way to wirelessly back up my mac?

    I was hoping I could use an existing external hard drive and hook it up to an Airport Express to wirelessly back up my system. Unfortunately, the USB port on the airport does not recognize external hard drives (from what I know). Thus, is Time Capsul

  • Macbook display on a 40" LCD

    is it possible? what do i need to buy? tv has hdmi inputs, everything except the 100gb processor, it is 80gb. please help!! macbook   Mac OS X (10.4.8)  

  • How can I see my sent Yahoo messages on my IPhone?

    All the suggestions so far have not been helpful?  Would I have have sent a message from my iPhone in order to see them? Is there a way to see all sent messages from my Yahoo account from my IPhone?

  • Not restarting

    i I did a hard reset, and once I did that my phone won't turn on. I need help to get it back on please, any suggestions?