Oracle 8i and stored procedures

Hi I was hoping someone could point me to the right direction here.
I have been using SQL server before and often use stored procedures. I understand that if you want to use stored procedures you will use the CallableStatement object and the prepareCall method of the Connection object like so:
let's say my stored proc has 2 number parameters:
CallableStatement cs = con.prepareCall( " { call <stored_proc_name> (?, ?) } );
cs.getString(1, 1);
cs.getString(2, 2);
ResultSet rs = cs.executeQuery( );
where con is my connection object that i used to connect to my database. So far am I right with the following code?
But my problem is I have to use Oracle 8i. So what is the equivalent of SQL server stored procs in Oracle? Is it functions? Procedures? Or Java Stored Procedures? I have been reading all these sites and the forums for ideas but still haev no clue what approach I should take
I have managed to connect to my db using the thin drivers and have successfully passed SQL statements. Although, I don't want to pass SQL statements, I want to use stored procedures. With SQL server I would create all my stored procedures and use my beans to call these stored procedures. So as a new user of Oracle 8i coming form SQL server, what approach do I use and how?
Thanks in advance for all the help!

Alright well looks like I'm stuck now.
This seems more like a PL\SQL question though. If I want to return 2 or more values do I use function or a procedure? here's the code I made:
CREATE OR REPLACE FUNCTION sign_in(username VARCHAR(20), userpassword VARCHAR(20))
RETURN NUMBER IS id_num NUMBER, user_type VARCHAR(1);
BEGIN
SELECT * INTO id_num, user_type
FROM ID_MASTER idm, PERSON prs
WHERE USERNAME = username
AND USER_PASSWORD = userpassword
AND idm.ID_NUM = prs.ID_NUM;
RETURN id_num, user_type;
END;
now according to Oracle this is an invalid function. But the error message doesn't say much. Basically I want to pass 2 parameters to use for a query and return 2 variables from the result of the query. Am I suppose to use a procedure?
If I pass paramters do which string do I use to prepareCall: "{ ? = CALL sign_in (?, ?) }" or do I use the "{ CALL sign_in (?, ?) }"
But my problem right now is how to make the proper stored procedure. I'd be very much obliged to anyone who can give a sample. Thank you all for your time!

Similar Messages

  • Oracle lite and Stored Procedures

    Hi, I have just installed Oracle lite, connected to Polite and created dropped tables etc. I notice that in Navigator there is no folder for stored procedures or triggers. I tried to compile a syntacally correct proc in SQL plus and it generated this error: Create or Replace Procedure SCORECARD.Gen_Fiscal_Year_Data AS
    ERROR at line 1:
    OCA-30021: error preparing/executing SQL statement
    [POL-5228] syntax error.
    Does this mean that stored procs are not supported in Oracle lite?
    Thanks, Paul
    null

    Oracle Lite database does not support the usual stored procedures/triggers like an Oracle database. You have to use java classes to create triggers/stored procedures to run them in Oracle Lite database. You can refer the documentation on Oracle 8i Lite for samples/detailed information.

  • For oracle cursor and stored procedure.

    Hi,
    I wanted to call a PL/SQL function that opens a cursor and gets a cursor
    back as a Java result set.Actually there is a readymade program in
    http://www.oradoc.com/ora816/java.816/a81354/samapp5.htm#1016411
    in the name RefCursorExample.java
    Now what I wanted to know is in weblogic how to do that.
    For example I would like you to help me to give the weblogic equivalent of a
    single line in that program.
    call.registerOutParameter(1, OracleTypes.CURSOR);
    Instead of OracleTypes.CURSOR...what should I write for weblogic JDriver for
    oracle.
    Please refer to my program in the attachment. FYI weblogic is already
    running when I execute the program and it creates oracle connection pools.
    Please also look at the exceptions it throws below.
    Exceptions are
    Exception java.sql.SQLException: ORA-06550: line 1, column 15:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 9:
    PL/SQL: Statement ignored
    java.sql.SQLException: ORA-06550: line 1, column 15:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 9:
    PL/SQL: Statement ignored
    at
    weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
    ava:76)
    at
    weblogic.jdbc20.rmi.internal.WLStub2z3m13133166452s5z42a5c4u4a3b1v.ex
    ecute(WLStub2z3m13133166452s5z42a5c4u4a3b1v.java:415)
    at
    weblogic.jdbc20.rmi.internal.CallableStatementStub.execute(CallableSt
    atementStub.java:454)
    at
    weblogic.jdbc20.rmi.SerialPreparedStatement.execute(SerialPreparedSta
    tement.java:401)
    at OracleDataSource.main(OracleDataSource.java:49)
    I would be great if you can help me out.
    Sincerely,
    Praveen.C
    [OracleDataSource.java]

    Also, see this KBA.
    And KBA 1525432
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Does Oracle have Extended Stored Procedure like SQL Server and Sybase?

    Hi, i am new to Oracle. I want to know if...
    Does Oracle have Extended Stored Procedure like SQL Server and Sybase?
    If it does not have, then how can i call outside program written in C or JAVA from the Database stored procedure or trigger?

    refer to this link on external procedures
    http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76956/manproc.htm#11064

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • DAC task with Informatica mapping and stored procedure (very slow)

    Hello,
    We have a DAC task that launch an Informatica Workflow with a simple query and stored procedure, like this:
    SQL QUERY
    ==========================
    SELECT
    W_ACTIVITY_F.ROW_WID,
    W_AGREE_D.AGREE_NUM,
    W_PRODUCT_D.ATTRIB_51,
    W_SRVREQ_D.ATTRIB_05,
    W_ORG_DH.TOP_LVL_NAME,
    W_ORG_D.ATTRIB_06,
    W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_PRODUCT_D.PROD_NAME
    FROM
    W_AGREE_D,
    W_SRVREQ_F,
    W_ACTIVITY_F,
    W_PRODUCT_D LEFT OUTER JOIN W_PRODUCT_GROUPS_D ON W_PRODUCT_D.PR_PROD_LN = W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_ORG_D,
    W_SRVREQ_D,
    W_ORG_DH
    WHERE
    W_SRVREQ_F.AGREEMENT_WID = W_AGREE_D.ROW_WID AND
    W_SRVREQ_F.SR_WID = W_ACTIVITY_F.SR_WID AND
    W_SRVREQ_F.PROD_WID = W_PRODUCT_D.ROW_WID AND
    W_SRVREQ_F.ACCNT_WID = W_ORG_D.ROW_WID AND
    W_SRVREQ_F.SR_WID = W_SRVREQ_D.ROW_WID AND
    W_ORG_D.ROW_WID = W_ORG_DH.ROW_WID
    STORED PROCEDURE
    ===========================
    ConvSubProy(W_AGREE_D.AGREE_NUM,
    W_PRODUCT_D.ATTRIB_51,
    W_SRVREQ_D.ATTRIB_05,
    W_ORG_DH.TOP_LVL_NAME,
    W_ORG_D.ATTRIB_06,
    W_PRODUCT_GROUPS_D.PRODUCT_LINE,
    W_PRODUCT_D.PROD_NAME)
    The mapping is very simple:
    Source Qualifier -> Stored procedure -> Update strategy (only two ports: ROW_WID and custom column) -> Target Table
    When I launch the DAC Execution Plan the corresponding task take much time (40 minuts). But when I launch the corresponding Workflow from Informatica PowerCenter Workflow Manager this only take 50 seconds... when I see the log session for the task I can see that much time is spent on the time of the updates. For example, when DAC is running the writer updates 10000 records every 6/7 minuts, but when Workflow Manager is running thw writer updates 10000 records every 8/9 seconds.
    So, what happens (in the DAC) to that so much time difference? Is there a way to reduce the execution time when the task is launched from DAC?
    Thanks
    Best Regards
    Benjamin Tey

    Have you tried using bulk load type?
    In Workflow Manager can you open the associated task, navigate to the mapping tab and seled the target table.
    What is the value for "Target load type" and which of the following boxes are checked: Insert, Update as Update, Update as Insert, Update else Insert, Delete?

  • Approval Procedures and Stored Procedures

    Hi All
    I have a problem with approval procedures and stored procedures.
    I created an approval procedure to check if a value in the udf is selected or not . if not then a messge is produced to ask the user to select the person to approve the PO.
    Biut now the problem is the PO's are linked approval templates to the error messge don't show before the approval template screen.
    Please assist.
    Thanks
    Bongani Dlamini

    Hi Gordon
    The stored procedure is just for validating if the user has selected the udf value.
    It is not for approval*
    I created an approval template for this purpose. So my problem is when I add the Po to the system the SP doesn't kick-in and alert the user to select the person to approve the PO.
    Process Flow.
    User captures PO then select the value on the UDF Field ( Approver) The value selected is linked to a query which is used by the Approval Template
    If this method is still not supported then please let me know .
    Thanks
    Bongani Dlamini

  • Could I export and import my oracle database via Stored Procedure???

    Hi all,
    I need to export my database using stored procedure, the stored procedure will be called by java application and it works well
    Now I still get the "BIG QUESTION", could I export and import database using stored procedure???
    Really thanks for the response.
    Regards,
    Kahlil

    Hi,
    I think you can use DBMS_DATAPUMP (10.1+), see [DBMS_DATAPUMP|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples see [http://www.psoug.org/reference/dbms_datapump.html]
    Regards,

  • Sending Long Raw Data to Oracle database through Stored  Procedure

    Hi,
    I am trying to push data to Oracle 9i database through Stored Procedure via thin driver. It is going smoothly upto 29411 bytes. But it is not accepting for 53843 bytes and giving following error :
    java.sql.SQLException: Data size bigger than max size for this type: 53843
    Is it thin driver limitation? Can I solve it by using OCI driver? Or is there any other approach?
    I tried creating connection pool in weblogic 7.0 through OCI driver. But I am not able to configure it. Is there any special way of configuration.
    Quick response will be greatly appreciated.
    Thanks
    Sanjiv

    It happens to me. But I am using CMP of Weblogic 7. If you write your own jdbc code, the following link may be helpful.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html

  • Prepared Statement and Stored Procedure difference?

    For SQL in my web applications I use PreparedStatement object alot in my JDBC working with Oracle 9i.
    I also heard the term Stored Procedure. What is the difference between Stored Procedure and Prepared Statement?

    I am new to java programming, can anybody explain
    what exactly precompiled means
    Thank you
    PalspaceWhat does you subject line have to do with your question?
    The difference between a stored proc and a prepared statement is mainly this.
    A stored proc is stored in the database server permanently and can be used and re-used from a different connections.
    A PreparedStatement is not valid across connections.
    Stored procs are almost always precompiled. (I am just hedging a bit here just in case but you can consider it 100%)
    PreparedStatements MAY be precompiled. Hard to say.
    Precompiling means at least one of and perhaps all of the following depending on the database
    - The parsing of the SQL statement
    - The checking of the SQL against the data dictionary to ensure that the tables and columns referenced actually exist
    - The preparation of a query plan
    Last but not least Stored procedures may (and often do) contain more than simple queries but are in fact relatively complex programs written in a DB specific language (an offshoot of SQL of some sort).

  • Oracle.DataAccess.Client stored procedure ORA-01403

    Hello,
    Microsoft announced that System.Data.OracleClient is deprecated and will be no more supported so I try to use the driver Oracle.DataAccess.Client after having installed ODP.
    It works fine except for stored procedures.
    After calling a stored procedure that increases a value in a column I meet this error :
    ORA-01403: no data found
    ORA-06512: at "XXXXX.MY_FUNCTION", line 15
    ORA-06512: at line 1
    Oracle Data Provider for .NET
    at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
    at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, Boolean bCheck)
    at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery()
    The same function worked very well during several years with OracleClient !
    Does any body has an idea ?
    Best regards
    Alan

    Hello,
    I had the solution by an other forum.
    It's necessary to define the property BindByName at true.
    The driver OracleClient did that by default not the driver DataAccess !
    Best regards

  • Cursors in Oracle 10g XE stored procedures

    I want to use a cursor in a stored procedure. I saw many examples on the net but none of them seem to work in Oracle 10g Express Edition.
    I am new to Oracle and any solution relevant to Oracle 10g XE is highly appreciated.
    Yosief Kesete

    Dear user!
    Simple error. Try that:
    CREATE OR REPLACE PROCEDURE "employeesgetlist
      p_FIRST_NAME IN VARCHAR2,
      returnValue OUT SYS_REFCURSOR
    IS
      p_EMPLOYEE_ID NUMBER;
      CURSOR C1 IS
      SELECT employee_id
      FROM employees
      WHERE first_name = p_FIRST_NAME;
    BEGIN
      BEGIN
        -- OPEN A PREVIOUSLY DECLARED CURSOR
        OPEN C1;
        LOOP
          FETCH C1 INTO p_EMPLOYEE_ID;
          EXIT WHEN C1%NOTFOUND;
        END LOOP;
         -- CLOSE THE CURSOR
        CLOSE C1;
      END;
      OPEN returnValue FOR
      SELECT * FROM employees
      WHERE employee_id = p_EMPLOYEE_ID;
    END;
    {code}
    Yours sincerely
    Florian W.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Oracle function in stored procedure to retreive particular table name

    Hi,
    I need to delete a table 'xxsys_dram_flatproperties' from database given model name as 'dram-model'.
    the model name can be any thing.corresponding table name will be[i] 'xxsys_<modelname>_flatproperties'.
    I wrote stored procedure .I am able to retrieve all the tables in the database using user_tables.Is there any funtion in oracle like
    if table name contains letters that are there in model name.
    Pleasehelp.

    Suppose all your tables created in the schema 'temp'
    and you are absolutly sure you want to drop only tables which have for example '_model3_' in its name (nothing else should have same part in your schema)
    then try a simple solution:
    CREATE TABLE temp.xx_model3_01 (col1 NUMBER)
    CREATE TABLE temp.xx_model3_02 (col1 NUMBER)
    SELECT table_name from all_tables where OWNER = 'TEMP' and table_name LIKE '%_MODEL3_%'
    TABLE_NAME                   
    XX_MODEL3_01                 
    XX_MODEL3_02
    DECLARE
       CURSOR c1
       IS
          (SELECT table_name
             FROM all_tables
            WHERE owner = 'TEMP' AND table_name LIKE '%_MODEL3_%');
    BEGIN
       FOR rec IN c1
       LOOP
          EXECUTE IMMEDIATE 'DROP TABLE ' || rec.table_name;
       END LOOP;
    END;

  • XML and Stored Procedures

    Hi,
    Is it possible to pass information to and from an Oracle stored procedure using a XML page? If so could you please point me to examples and/or white pages?
    Thanks!
    Tess

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Lillian Goodwin ([email protected]):
    Hi,
    Is it possible to pass information to and from an Oracle stored procedure using a XML page? If so could you please point me to examples and/or white pages?
    Thanks!
    Tess<HR></BLOCKQUOTE>
    Look at DB Prism, it works like Oracle Web Server but is based on servlet technology.
    With DB Prism you could make an stored procedure in PLSQL or Java and receive the XML values directly using the HTTP protocols.
    DB Prism is at Plenix Web Site
    This week DB Prism 1.1.0-dev will be ready for downloading including full compatibilty with OWS/OAS/IAS/Web DB toolkits.
    Best regards, Marcelo
    null

  • Schemas and stored procedures

    Hi,I'm new at Oracle so I don't know how silly my question must sound. I would like to know if I can execute a stored procedure, without refering to its schema in the beginning, from an schema B if I'm logged in as a user from schema A. I got an error if I dont executed as "B.SP_SONTHING". What's my problem is it a matter of grants or what?
    Thanks
    Mike.

    Check this thread - synonym
    The appropriate forums for general PL/SQL and Database Issues are -
    PL/SQL
    General Database Discussions
    You may want to post your further queries in these forums for better response.

Maybe you are looking for