Stored Procedure Syntax

Hi,
I am new to Oracle and am trying to execute a stored procedure with parameters ..but I keep getting the error:
ORA 00900- Invalid SQL Statement ....Below is the SQL statement.... I am able to run the SQL successfully on the SQL server with slight modifications .....I am using the Oracle SQL Developer tool...
execute CARD_SUMMARY (212,"ALL","ALL","ALL","ALL","ALL","01/01/2010","01/01/2011");
Please advice...
Thank you,

Here is the stored procedure :
create or replace PROCEDURE "CARD_SUMMARY" ( rs out sys_refcursor,
region_cd in varchar2,
branch_cd in varchar2,
state in varchar2,
source_cd in varchar2,
reason_cd in varchar2,
start_date in varchar2,
end_date in varchar2 )
is
v_region_cd varchar2(6);
v_branch_cd varchar2(6);
v_state varchar2(3);
v_source_cd varchar2(6);
v_reason_cd varchar2(6);
v_start_date DATE := to_date(start_date,'mm/dd/yyyy');
v_end_date DATE := to_date(end_date,'mm/dd/yyyy');
BEGIN
IF region_cd <> 'ALL' THEN
v_region_cd := region_cd;
END IF;
IF branch_cd <> 'ALL' THEN
v_branch_cd := branch_cd;
END IF;
IF state <> 'ALL' THEN
v_state := state;
END IF;
IF source_cd <> 'ALL' THEN
v_source_cd := source_cd;
END IF;
IF reason_cd <> 'ALL' THEN
v_reason_cd := reason_cd;
END IF;
IF v_state = '1' THEN
open rs FOR
select br.branch_name as "branch",
u.username as "username",
Count(ch.source_cd)
from credential_history ch,
member mbr,
membership ms,
branch br,
codes cd,
iusers u,
sales_agent sa
where ch.waived_by = u.user_id
and mbr.member_ky = ch.member_ky
and u.user_id = sa.user_id
and sa.user_id = ch.waived_by
and sa.branch_ky = br.branch_ky
and mbr.membership_ky = ms.membership_ky
and ch.reason_cd in ('DUPC')
and ch.reason_cd = cd.code
and cd.code_type = 'DCREAS'
and cd.code = nvl(v_reason_cd, cd.code)
and br.branch_cd = nvl(v_branch_cd, br.branch_cd)
and br.region_cd = nvl(v_region_cd, br.region_cd)
and ch.source_cd = nvl(v_source_cd, ch.source_cd)
and br.state not in ( 'PA' )
and ch.card_req_dt between v_start_date and v_end_date
group by br.branch_name, u.username, ch.source_cd
order by br.branch_name, u.username, ch.source_cd;
ELSE
open rs FOR
select br.branch_name as "branch",
u.username as "username",
Count(ch.source_cd)
from credential_history ch,
member mbr,
membership ms,
branch br,
codes cd,
iusers u,
sales_agent sa
where ch.waived_by = u.user_id
and mbr.member_ky = ch.member_ky
and u.user_id = sa.user_id
and sa.user_id = ch.waived_by
and sa.branch_ky = br.branch_ky
and mbr.membership_ky = ms.membership_ky
and ch.reason_cd in ('DUPC')
and ch.reason_cd = cd.code
and cd.code_type = 'DCREAS'
and cd.code = nvl(v_reason_cd, cd.code)
and br.branch_cd = nvl(v_branch_cd, br.branch_cd)
and br.region_cd = nvl(v_region_cd, br.region_cd)
and ch.source_cd = nvl(v_source_cd, ch.source_cd)
and br.state = nvl(v_state, br.state)
and ch.card_req_dt between v_start_date and v_end_date
group by br.branch_name, u.username, ch.source_cd
order by br.branch_name, u.username, ch.source_cd;
END IF;
END CARD_SUMMARY;
The statements that I have tried are :
CALL CARD_SUMMARY('ALL','ALL','ALL','ALL','ALL',DATE '2010-01-01',DATE '2011-01-01'); ----This throws wrong number or types of argument error...
BEGIN
CARD_SUMMARY('ALL','ALL','ALL','ALL','ALL',DATE '2010-01-01',DATE '2011-01-01'); ---------This throws wrong number or types of argument error...
END;

Similar Messages

  • MySQL Stored Procedure Syntax Errors

    I have an online application I would like to use transactions to either commit all db updates or none at all. The code I have created is as follows, not only am I getting a syntax error on lines 5 and 16, but quite frankly I am unsure the code will actually do what I want. Please let me know if you see the syntax errors and could explain them to me.
    CREATE PROCEDURE increase_maint_priority
        (maint_item INT, new_priority INT, cur_priority INT, center_id INT)
    BEGIN
        START TRANSACTION; -- line 5 syntax error
        -- start updates
        UPDATE maintitem SET priority = (priority+1)
            WHERE priority > cur_priority
            AND priority <= new_priority
            AND centerID = center_id;
        UPDATE maintitem SET priority = new_priority
            WHERE id = maint_item;
        COMMIT;
    END; -- line 16 syntax error
    Thank you in advance for helping a newb to stored procedures.
    If you would like to help me figure out if this code will actually work for what I want the following describes the situation.
    Main idea: business location managers submit requests for maintenance at their center. Requests can be added anywhere in the priority list (1=highest priority). They can also change the priority of a request at any time.
    Previously I have been using php to control a loop of mysql update queries (yikes, I know now, 2 sql statements could do the trick) and lately we have been experiencing duplicate priorities, and other problems that seem to be most likely linked to the updating of priorities of multiple items.
    Ex: moving priority item 6 to priority 1 requires 1 update query for the current 6th priority item, but a second query (or loop of several more since I was very new to sql statements at time of development 2 years ago) to update the other priorities.
    Thus the desire for the transaction method.
    Again, thanks in advance for any help on this issue.
    P.S. - I am using MySQL workbench to write this and that's where I get the errors.

    Yes, of course.
    DELIMITER //
    CREATE PROCEDURE increase_maint_priority
        (maint_item INT, new_priority INT, cur_priority INT, center_id INT)
    BEGIN
        START TRANSACTION;
        -- start updates
        UPDATE maintitem SET priority = (priority+1)
            WHERE priority > cur_priority
            AND priority <= new_priority
            AND centerID = center_id;
        UPDATE maintitem SET priority = new_priority
            WHERE id = maint_item;
        COMMIT;
    END //
    DELIMITER ;
    Just so you're aware, the table name is actually in a slightly dfferent format: `db_name`.`table_name` I have just renamed it for privacy purposes.

  • Stored Procedure syntax error

    I'm trying to create a stored procedure that does not have any IN or OUT parameters. It gives syntax errors:
    create or replace
    procedure GEN_NEW_DATA
    as
    cursor for_msgid is select PARENTID from WORKITEM;
    msgid_rec for_msgid%rowtype;
    begin
    for msgid_rec in for_msgid loop
    update FIELDTYPE set FIELDVALUE= (select ACCOUNTID from ACCOUNT where ACCOUNTNAME= (select FIELdVALUE from FIELDTYPE where FIELDNAME= msgid_rec.PARENTID || 'xAgency' ) ) where FIELDNAME= msgid_rec.PARENTID || 'xAgency';
    commit;
    end loop;
    dbms_output.put_line('Done');
    end;
    Can someone help me with the syntax here.

    msgid_rec for_msgid%rowtype;I think this is not allowed..
    ----Try this
    create or replace
    procedure GEN_NEW_DATA
    as
    cursor for_msgid is select PARENTID from WORKITEM;
    --msgid_rec for_msgid%rowtype;
    begin
    for msgid_rec in for_msgid loop
    update FIELDTYPE set FIELDVALUE= (select ACCOUNTID from ACCOUNT where ACCOUNTNAME= (select FIELdVALUE from FIELDTYPE where FIELDNAME= msgid_rec.PARENTID || 'xAgency' ) ) where FIELDNAME= msgid_rec.PARENTID || 'xAgency';
    commit;
    end loop;
    dbms_output.put_line('Done');
    end;
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Update stored procedure syntax

    Can someone post an example of a stored procedure that is used to update a row in a table with a primary key.... thought it would be easy enough to find an eg on google but no luck so far.
    Cheers

    Hey if you dont have the Primay Key or Any other key
    then for updating the table records, always use the
    Rowid "ABC" in you select statements ie in the Cursor
    and then alsways use that RowId in your update
    statements.
    It will work fast & 100% correct also.!!!!I would have thought the statement:
    Can someone post an example of a stored procedure that is used to update a row in a table with a primary key
    would be good indication that it has a primary key.
    And if you're talking about updating rows from a cursor then surely it would be easier to use a CURSOR ... FOR UPDATE statment and then UPDATE ... WHERE CURRENT ... to update the current row. Why the need for using ROWID's?

  • Strange error while executing a stored procedure: Incorrect syntax near '@p0'

    All, I am getting a strange error while executing a stored procedure: Incorrect syntax near '@p0'  using JDBC CallableStatment.
    Here is my code...
    CallableStatement cStmt = con.prepareCall("{call SET CHAINED ON EXEC <dbName>.<schemaName>.<SPName> (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
    cStmt.setString(1, "2012005881");
    cStmt.setString(2, "07");
    cStmt.setString(3, "10");
    cStmt.setString(4, "Case title");
    cStmt.setString(5, "Open");
    java.sql.Date dt1 = new java.sql.Date(2014,10,20);
    cStmt.setDate(6, dt1);
    cStmt.setString(7, "01");
    cStmt.setString(8, "N");
    cStmt.setString(9, "ADA Test");
    cStmt.setString(10, "N");
    cStmt.setString(11, "English");
    cStmt.setString(12, "N");
    cStmt.setString(13, "N");
    cStmt.setString(14, "N");
    cStmt.setString(15, "N");
    cStmt.setString(16, "N");
    cStmt.setString(17, "N");
    cStmt.setString(18, "07");
    cStmt.setString(19, "10");
    cStmt.setString(20, "juache0");
    java.sql.Date dt2 = new java.sql.Date(2014,10,20);
    java.sql.Date dt3 = new java.sql.Date(2014,10,20);
    cStmt.setDate(21, dt2);
    cStmt.setDate(22, dt3);
    cStmt.setString(23, "userid0");
    cStmt.setString(24, "");
    cStmt.setString(25, "");  
    cStmt.setString(26, "");
    java.math.BigDecimal bg1 = new java.math.BigDecimal(10);
    cStmt.setBigDecimal(27, bg1);
    cStmt.setString(28, "userid");
    cStmt.setString(29, "userid");
    int hadResults = cStmt.executeUpdate();
    Your help is greatly appreciated.
    I am executing the above using Jconnect3.0 driver, inside WebSphere Application Server V8.0
    Thanks
    Nags

    NOTE: I don't work with JDBC/jConnect so (at this point) just some questions ...
    1 - are you sending this to ASE, ASA, IQ, or some other RDBMS?
    2 - what is the value of <schemaname>?
    3 - do you have other prepareCall() instances that successfully call a stored proc? [would be interesting to see if there's a difference in the format of the calls]
    A quick google search shows a couple ways to submit a stored proc execution to the RDBMS, with the format depending on the format expected by the target RDBMS.
    I'm wondering if you really need/want the parentheses around the argument list, ie, what happens if you change
    from
    -- parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ( ?,?,?,?,?,...,? )
    to
    -- no parentheses around args
    EXEC <dbName>.<schemaName>.<SPName> ?,?,?,?,?,...,?
    In ASE if I wrap the parameters in parentheses I get the same error you're getting:
    ================== w/ parentheses => error
    1> sp_who (sa)
    2> go
    Msg 102, Level 15, State 1:
    Server 'CC1_V1', Line 1:
    Incorrect syntax near 'sa'.   <<=== sa == @p0 ??
    ================== w/out parentheses => works
    1> sp_who sa
    2> go
    fid spid status  loginame origname ...
       0   17 running sa       sa       ...
    ==================

  • Facing syntax error while calling stored procedure

    hi
    iam calling a stored procedure which is a sybase USP.my code is as follows
    clsm3=CommonLib.cnClient.prepareCall("{call SYB1103.SIFGSYS..USP_Ins_ShipmentInvLines_Tmp "+coid+",'"+invclass+"',"+newsysno+","+productcd+",'"+batchno+"',"+qty+","+productrate+","+assrate+","+expercent+","+examt+","+saleed+","+bonused+",'"+recby+"',"+linestat+","+brno+","+prinvno+","+invno+","+recno+"}");
    clsm3.executeUpdate();
    where clsm3 is an object of CallableStatement.but it is giving me a syntax error saying
    "Invalid JDBC escape syntax at line position 84 '}' character expected"
    please reply as soon as possible

    clsm3=CommonLib.cnClient.prepareCall("{call
    {call SYB1103.SIFGSYS..USP_Ins_ShipmentInvLines_Tmp
    "+coid+",'"+invclass+"',"+newsysno+","+productcd+",'"+
    batchno+"',"+qty+","+productrate+","+assrate+","+exper
    cent+","+examt+","+saleed+","+bonused+",'"+recby+"',"+
    linestat+","+brno+","+prinvno+","+invno+","+recno+"}")
    ;clsm3=CommonLib.cnClient.prepareCall("call <PROCEDURE_NAME>(?,?,?,....)
    clsm3.setString(1,coid);
    clsm3.setInt(2,invclass);
    and so on...
    Try the above. The syntax of the call is wrong in your code.

  • Syntax of creating a stored procedure in Ms Access

    I need to create a stored procedure in Ms Access and i need to create it via a java program .This is the query i have written
    CREATE PROCEDURE procProductsList As
    Select A.Id,B.L_Name from Transaction A,Member B where A.Id = B.Id and A.Id = [@emp] and A.Name = [@name].But when i try to run it i get an error as Syntax error in CREATE TABLE statement.Plz could sumone help.

    //Creates a stored procedure as a resultset
    boolean createStoredProcedure(String strSql,Connection connect)
    Statement stmt=null;     
         int columnCount=0;
         try
              if(connect.isClosed()==true)
                   return false;
                   else
                   stmt=connect.createStatement();
                   stmt.executeUpdate(strSql);                                             
              } //End else
         } //End try
         catch(SQLException sql)
              System.out.print("Sql Exception caught");
              sql.printStackTrace();
              return false;
         } //End catch
         return true;
         } //End function
    //Function for passing the number of parameters in the parameters list
    String getInvokeParamsList(Vector vector)
         String strParamsInvokeList = new String("");
         if(vector==null)
    strParamsInvokeList=null;
         else
              strParamsInvokeList += "(";
              for(int i=0; i < vector.size(); i++)
                   strParamsInvokeList += "?";
                   if(i < (vector.size() - 1))
                        strParamsInvokeList += ", ";
              strParamsInvokeList += ")";
         return strParamsInvokeList;
    //Calls a stored Procedure
    ResultSet callStoredProcedure(Connection connect,String strProcedureName,Vector vecValues)
         ResultSet rs=null;
         try
                   CallableStatement cs = connect.prepareCall("{call " + strProcedureName + getInvokeParamsList(vecValues) + "}");
                   for(int i=0;i<vecValues.size();i++)
                   cs.setString(i+1,(String)vecValues.get(i));
                   rs = cs.executeQuery();
    catch(SQLException sql)
              System.out.print("Sql Exception caught: " + sql.toString());
              sql.printStackTrace();
    catch(NullPointerException npexp)
              System.out.print("NullPointerException Exception caught: " + npexp.toString());
              npexp.printStackTrace();
         return rs;//End catch
    class database1
              public static void main(String[] args)
                   try
                        String strFilepath="C:\\trainee";
                        String strFilename="config.xml";
                        String strvendor="TICPEN0001003";
                        String str1="CREATE PROCEDURE procProductsList As Select A.Id,B.L_Name from Transaction A,Member B where A.Id = B.Id and A.Id = [@emp] and A.Name = [@name]";
                        String proc="stproc";
                        int columnCount=0;
                        clsDatabase clsdb=new clsDatabase(strFilepath,strFilename,strvendor);
                        Connection boolConn=clsdb.getConnect();
                        Vector vec=new Vector();
                        if(boolConn!=null)
                             System.out.println("Connection established");     
                             vec.add("3");
                        vec.add("Glove");
                             boolean b1=clsdb.createStoredProcedure(str1,boolConn);
                             if(b1==true)
                                  ResultSet rs1=clsdb.callStoredProcedure(boolConn, proc, vec);
                                       if(rs1==null)
                                       System.out.println("rs1 null");
                                  else
                                       ResultSetMetaData rsmd = rs1.getMetaData();                         
                                       columnCount = rsmd.getColumnCount();
                                       while(rs1.next())
                                            for(int i=1 ;i<=columnCount; i++)
                                                 String value=rs1.getString(i);
                                                 System.out.println(value);
                             else
                             System.out.print("Stored Procedure not created");
                   else
                        System.out.println("Connection not established");      
    catch(Exception e)
                        //System.out.println("Exception caught4: " + e.toString());
                        e.printStackTrace();
                   }                                                                                          //End catch
         }                                                                                          //End main
    }

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

  • Trying to execute a stored procedure gives: Syntax error or access violatio

    Hi,
    I have a stored procedure that runs fine in sqplus:
    EXEC load_image('distribuido.JPG', '1');
    When i try to execute it in PHP it gives me this error:
    [Oracle][ODBC]Syntax error or access violation.
    In php i'm using ODBC functions, with the same user configured in dsn. The sql i run in php is 100% equal...
    What's the problem and how should i run this procedure in php (or maybe grant more privileges to this user??)
    The procedure is:
    CREATE OR REPLACE PROCEDURE load_image( filename VARCHAR2, vid_membro INTEGER )
    AS
    file_lob BFILE;
    binary_lob BLOB;
    mime_type fotografia.foto_tipo%type;
    extension_pos NUMBER;
    BEGIN
    extension_pos := INSTR( filename, '.' );
    mime_type := 'image/' || SUBSTR( filename,
    extension_pos + 1,
    LENGTH( filename ) );
    INSERT INTO fotografia (id_foto, id_cat, id_membro, nota_media, num_votos, foto_tipo, fotografia)
    VALUES (fotografias_id.nextval, 1, vid_membro, 0, 0, mime_type, empty_blob())
    RETURNING fotografia INTO binary_lob;
    file_lob := BFILENAME( 'IMAGES', filename );
    dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
    dbms_lob.loadFromFile( binary_lob,
    file_lob,
    dbms_lob.getLength( file_lob ) );
    dbms_lob.fileClose ( file_lob );
    END;
    /

    'exec' is an sqlplus directive. If you run this query in PHP, try:
    $query = "BEGIN
    load_image('distribuido.JPG', '1');
    END;";
    (you may have to remove the ; after 'END')

  • Url syntax to call stored procedure

    I want to call a stored procedure (STOERFALL_PROC). owner is ELVE_TEST
    v_ba_id and v_sf_id are paremeters for the procedure
    #SF_BA_ID# and #BEARBEITEN# are column values of my reports region for the parameters
    in the url field of the column link attributes of my report region i set this url syntax to call the proc
    #ELVE_TEST#.STOERFALL_PROC?v_ba_id=#SF_BA_ID#,v_sf_id=#BEARBEITEN#
    but it doesn´t works and I don´t know why.
    Can me help someone?

    user512746 (you can have a name display by going to "Your Control Panel") -
    Are you by chance using a manually created report region, using htmldb_item (or apex_item)?
    If so, then your problem may be what is discussed in the thread at Column value substitution in tabular form element attributes
    and
    Column value substitution in tabular form element attributes
    (specifically near the end of each thread).
    If you're using a wizard generated report, then the problem may be different, I'm not sure.
    Hope this helps.
    Bill Ferguson

  • How to find out date in oracle when the Stored procedure in changed.

    Dear Sir,
    I want to know the list of dates when stored procedure is modified during a given period.
    eg. Procedure created 01/01/2011
    i changed the procedure 4 times say 01/10/2011,01/12/2011,01/01/2012 and 20/12/2012.
    from where i can get these details along with the other details like what will be procedure syntax at different modifications and most important what is ipof machine.
    thanks & regards
    Munish

    user9216770 wrote:
    Dear Sir,
    I want to know the list of dates when stored procedure is modified during a given period.
    eg. Procedure created 01/01/2011
    i changed the procedure 4 times say 01/10/2011,01/12/2011,01/01/2012 and 20/12/2012.
    from where i can get these details along with the other details like what will be procedure syntax at different modifications and most important what is ipof machine.
    thanks & regards
    MunishOracle does NOT retain or contain previous versions.
    You should be able to obtain these from your Source Code Repository; like Subversion.

  • How to pass the parameter values to the stored procedure from java code?

    I have a stored procedure written in sqlplus as below:
    create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
    I am trying to insert a new row into the database using the stored procedure.
    I have called the above procedure in my java code as below:
    CallableStatement sp = null;
    sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
    How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
    Kindly guide me as I am new to java..

    Java-Queries wrote:
    I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL.

  • Passing multiple values to a stored procedure

    Hi All,
    I have a stored procedure which displays a chart. The header of this procedure is:
    create or replace procedure chart ( p_period IN VARCHAR2) is
    When calling this procedure with something like the folloeing:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=MONTH">
    everything works OK.
    Now, I would like to replace p_period=MONTH with a value coming from an ITEM on the page, so something like:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=:P13_PERIOD">
    However, the above doesn't work.
    Can anyone give me the correct syntax please?
    Also what would be the syntax for passing more than one value? ie:
    source=ohsinit.chart?p_period=:P13_PERIOD,p_start=:P13_START_DATE ?
    Regards,
    Pawel.

    Hi Denes,
    I am not sure I understand your post...
    What I am trying to do here is to pass 3 values namely
    P13_PERIOD (VARCHAR2),
    P13_START_DATE (DATE),
    P13_END_DATE (DATE)
    into a stored procedure which displays the graph.
    So far I managed to get it working using:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.">
    However when I try to put in:
    <PARAM NAME=movie VALUE="/i/charts.swf?library_path=/i/charts_library&xml_source=ohsinit.chart?p_period=&P13_PERIOD.,p_start=&P13_START_DATE.">
    I get the graph blank (but not the orange timeout message... if you are familiar with XML/SWG graphs.)

  • Passing Dynamic Values to a Stored Procedure

    I have a stored procedure to create a Table. How to I pass a
    value to the procedure to name the Table. This SP works except the
    name of the table is @newcomm not the value I am trying to pass in.
    What is the proper syntax to make this happen.
    CREATE PROCEDURE [dbo].[sp_newcommenttbl]
    @newcomm varchar (50)
    AS
    BEGIN
    CREATE TABLE [dbo].[@newcomm] (
    [configid] [int] IDENTITY (1, 1) NOT NULL ,
    [email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [adminemail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [erroremail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [toCommentFormEmail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [dbusername] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlactivate] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlresetpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [initialized] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename1] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename4] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename5] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename6] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename7] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename8] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename9] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename10] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [pageheader] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL
    ) ON [PRIMARY]
    END
    GO
    <cfstoredproc procedure="sp_newcommenttbl"
    datasource="xxxxx" returncode="no">
    <cfprocparam type="in" maxlength="50"
    cfsqltype="cf_sql_varchar" value="pighg3">
    </cfstoredproc>

    When I create the procedure I don't get an error. I get an
    error when I call it.
    [Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect
    syntax near the keyword 'ON'.
    ColdFusion cannot determine the line of the template that
    caused this error. This is often caused by an error in the
    exception handling subsystem.
    Here is the call.
    <cfstoredproc procedure="sp_newcommenttbl"
    datasource="pisecurity" returncode="no">
    <cfprocparam type="in" maxlength="50"
    cfsqltype="cf_sql_varchar" value="pighg3" variable="newcomm">
    </cfstoredproc>
    Here is the syntax for the SP.
    CREATE PROCEDURE [dbo].[sp_newcommenttbl]
    @newcomm varchar (50)
    AS
    BEGIN
    EXEC('CREATE TABLE [dbo].['+@newcomm+'] (
    [configid] [int] IDENTITY (1, 1) NOT NULL ,
    [email] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [adminemail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [erroremail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [toCommentFormEmail] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [gmdsn] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
    NULL ,
    [dbusername] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [acfcpath3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlactivate] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [urlresetpassword] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [initialized] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename1] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename2] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename3] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename4] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename5] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename6] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename7] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename8] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename9] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [dbtablename10] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL ,
    [pageheader] [varchar] (50) COLLATE
    SQL_Latin1_General_CP1_CI_AS NULL
    ON [PRIMARY]')
    END
    GO

  • Call a pl/sql stored procedure from a report link

    Hello everyone:
    I have a report with a link in a column, which takes you to another page and passes values to that page, but also need the link, run a stored procedure before going to the other page.
    In the Forum I found cases similar to this, but none of the examples is clear to me how I do this. It seems that the target of the link should be URL, and also I have to call the stored procedure with a javascript function.
    My questions are:
    - Is this the best method to make what I need?
    - How should be the syntax of the link that takes me to another page and run the "stored procedure"
    - How and where I put the function "javascript" to run the "stored procedure"
    BDD: Oracle 11 g
    Apex version 4.1
    Best regards
    Gerard

    Hi,
    Change the link to call an apex.submit process. (javascript).
    Edit:
    I've set up a basic example.
    Region 1 (just so you can see the value getting set):
    select :P27_HIDDEN item_Value
    from dual
    Region 2:
    select rownum id, dbms_random.string('U', 12) sss
    from dual
    connect by level <= 20
    item attributes for ID:
    Target: URL
    URL: javascript:apex.submit({request:'NAVIGATE', set:{'P27_HIDDEN':#ID#}});
    (P27_HIDDEN is just a hidden item i created)
    http://apex.oracle.com/pls/apex/f?p=54920:27
    Edit2:
    In your case, then you can just have a page process based on conditions request = expression1, expression1: NAVIGATE..... then a page branch to go to the desired page, also with the same conditions
    Edit3:
    Im not sure what examples you are referring to , as you didn't supply any links; but you mention calling the stored procedure from javascript, so would likely involve some AJAX, but imo not necessary.

Maybe you are looking for

  • Pls need help with

    Hello. Actually i dont have programming skills so much and just tryingt to make ebay listing with dreamvever using Spry .I have a alsmost finsihed the the page, just one problem with spry I am trying to bulld collapsible Tab menu on my page and  the

  • How do I save a file as bmp in CS6

    There is no bmp option in file >save as or in Save for web.  Is there a way in CS6 to save as a bmp file?

  • Populating a SELECT list from an Oracle Table

    Hello, I would like to populate a second SELECT list on a web page based on the selected value in the first SELECT list. I would like to take the value that the user selects in the first SELECT list and use it in a WHERE clause to bring back distinct

  • Adobe:"NO COMPLAINTS PLEASE" Open Letter

    Dear Adobe, Like SO VERY MANY other people, I'm frustrated and angry with you. You make some of the best software, which is why we all tolerate your bad behaviour. Your reluctance to improve only ADDS to our frustration: I've spent the last hour tryi

  • Remove/decommission standby

    Hello I have 10G RAC database and have data guard with 2 physicals standby's in place and both standby's are non RAC I want to decommission one of the standby's meaning the primary should not know this standby exist or try sending logs Any steps/help