Arguments in a stored procedure.

Hi,
Please can you tell me:
What is the maximum size of a VARCHAR2 parameter as passed as an argument in an Oracle stored procedure.
e.g.
CREATE OR REPLACE PROCEDURE test (test_param VARCHAR2)
IS
The maximum string length of test_param is?
Thanks,
Duncan

In the declaration of a stored procedure only the argument types are specified, not the sizes or lengthsIt's annoying that we cannot enforce sizings even if we use a SUBTYPE to declare a parameter in a procedure's signature: it can only be done inside the procedure itself....
SQL> create or replace package my_subtypes as
  2     subtype ltd_string is varchar2(10);
  3  end;
  4  /
Package created.
SQL> create or replace function my_f
  2      (p_in in my_subtypes.ltd_string)
  3      return number
  4  as
  5  begin
  6      return length(p_in);
  7  end;
  8  /
Function created.
SQL> select my_f(to_char(sysdate, 'dd-mon-yyyy hh24:mi:ss'))
  2  from dual
  3  /
MY_F(TO_CHAR(SYSDATE,'DD-MON-YYYYHH24:MI:SS'))
                                            20
SQL> create or replace function my_f
  2      (p_in in my_subtypes.ltd_string)
  3      return number
  4  as
  5      lv my_subtypes.ltd_string;
  6  begin
  7      lv := p_in;
  8      return length(lv);
  9  end;
10  /
Function created.
SQL> select my_f(to_char(sysdate, 'dd-mon-yyyy hh24:mi:ss'))
  2  from dual
  3  /
select my_f(to_char(sysdate, 'dd-mon-yyyy hh24:mi:ss'))
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "APC.MY_F", line 7
SQL>Cheers, APC
blog: http://radiofreetooting.blogspot.com

Similar Messages

  • Passing variable number of arguments in a stored procedure

    Hi Team,
    i am facing a problem. I have a dynamic form which contains some checkboxes. The number of checkboxes are dynamically generated on querying the database. On the form submission i want to call a stored procedure that will update the values in the database. i want to know that is there any way to handle variable number of arguments in the stored procedure or can i get the variables through some session context and use it in my stored procedure.
    Any help is greatly appreciated.
    Thanks&Regards
    Saurabh Jain

    Hi Saurabh,
    The method in which stored procedures are called on form submit is something as follows.
    Let us take your scenario of a form which has multiple checkboxes and a submit button. On clicking the submit button, this form data is submitted using either get or post. The form's submit action invokes a procedure.
    The HTML form code will look something like this..
    htp.formOpen( curl => 'URL /myProcedure',
    cmethod => 'post' );
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'A');
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'B');
    htp.formCheckbox( cname => 'myCheckbox'
    cvalue => 'C');
    htp.formSubmit( cname => 'myButton',
    cvalue => 'OK');
    Now, whenever the submit button is clicked, all these form values are passed to our stored procedure 'myProcedure'.
    "myProcedure" looks something like this.
    procedure myProcedure
    myCheckbox IN sys.owa_util.vc_arr,
    myButton IN VARCHAR2
    is
    begin
    end myProcedure;
    The point to be noted here is that the name of the variable being passed in the procedure is the same as the name of the HTML element being created in the HTML form. So, there is a direct mapping between the elements in the HTML form and the procedure parameters.
    Another noteworthy point is that since you have multiple checkboxes in your HTML form, it is impractical to name all the checkboxes differently and then pass those many parameters to your procedure (Imagine a scenario where there are a hundred check-boxes in an HTML form!). So portal allows you to give the same name (cname) to all the checkboxes in your HTML form, and if multiple checkboxes are checked, it will return all the checkbox values in an array (Note the usage of "myCheckbox IN sys.owa_util.vc_arr" in myProcedure).
    You can check out this link for more information.
    Re: retrieving data from fields
    Thanks,
    Ashish.

  • How many number of input/output arguments allowed in Stored procedure

    Please let me know how may input and output arguments are allowed in Oracle stored procedure.
    I wan't to writer one generic SP and for that I need to know the limitation on the number of arguments. I am using Oracle 8.0.5.

    The output from the BPEL process will be in XML format.
    Your requirement is not clear, please state it properly what are you trying to do.
    -Yatan

  • How to get list of parameters or arguments for a stored procedure

    Hi,
    Is there a way we can get the list of arguments or parameters for a stored procedure through Data Dictionary?
    I mean the way oracle has Meta Data tables like user_tables/dba_tables, user_triggers/dba_triggers through which we can get information about tables, triggers etc, in the same way is there a way in oracle so that we can get information about a procedure like what kind of arguments need to be passed, are they IN or OUT parameters, and what is their Data Types?
    I could find there is one View dba_procedures, but it does not give any information about the arguments a procedure takes.
    Thanks,
    Makrand
    Thansk

    or
    SQL> desc Raisesal ;
    PROCEDURE Raisesal
    Argument Name                  Type                    In/Out Default?
    ID                             NUMBER(4)               IN
    PERCENT                        NUMBER                  IN

  • Passing array as a argument in the Stored Procedure/Function

    Hello Friends,
    I need a help, i Want one stored proedure/Function which take array as a argument and return an array also.
    and the size of array should not be fixed.
    I don't want to use Varray because for this I have to specified its size first.
    I think Associative arry will work( For dynamic size) but I am not able to run it .
    Is Associative arry(Index by Pls_Integer) support JDBC?
    If yes, plz give me some clue. I have found some information of associative array in this url
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17odp.html
    But I am not able to run this package through SQL and also not able to connect it through JDBC.
    Is there any other alternative solution?
    Thanks & Regards,
    manish Kumar

    This is my table structure :
    SQL> desc jobs
    Name Null? Type
    JOB_ID      NOT NULL VARCHAR2(10)
    JOB_TITLE      NOT NULL VARCHAR2(35)
    MIN_SALARY NUMBER(6)
    MAX_SALARY NUMBER(6)
    My Requirement is, User will enter the above field value in the form of array. I need to store these value and after manupulating this I will return that value also.
    Here I am using procedure just for testing purpuse.
    In my case I will take one array argumentlike JOB_ID and after manupulating these data I will return that array value.
    I am also not able to run this example through SQL.
    Can U give me exact code for running this prog.
    create or replace package associative_array as
    -- define an associative array type for each column in the jobs table
    type t_job_id is table of jobs.job_id%type index by pls_integer;
    type t_job_title is table of jobs.job_title%type index by pls_integer;
    type t_min_salary is table of jobs.min_salary%type index by pls_integer;
    type t_max_salary is table of jobs.max_salary%type index by pls_integer;
    -- define the procedure that will perform the array insert
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary in t_max_salary);
    end associative_array;
    create or replace package body associative_array as
    -- implement the procedure that will perform the array insert
    procedure array_insert (p_job_id in t_job_id,
    p_job_title in t_job_title,
    p_min_salary in t_min_salary,
    p_max_salary in t_max_salary) is
    begin
    forall i in p_job_id.first..p_job_id.last
    insert into jobs (job_id,
    job_title,
    min_salary,
    max_salary)
    values (p_job_id(i),
    p_job_title(i),
    p_min_salary(i),
    p_max_salary(i));
    end array_insert;
    end associative_array;
    Regards,
    manish Kumar

  • Running ".sh" file from a stored procedure

    Hi,
    I need to call a file.sh linux bat file whit arguments from a stored procedure.
    How can I do?
    Thanks in advance...

    Hi rajni,
    I've tryed your solution but it doesn't work, for the same reason that yuo can see here:
    Re: questions about dbms_scheduler.create_job (ORA-27371)
    I've also tryed the solution of the "user534897", but it doesn't work too.
    At execution time Oracle give me this error:
    ORA-29540: class djv_osCommand does not exist
    ORA-06512: at "CICCSV.DPK_OSCOMMAND", line 5
    ORA-06512: at "CICCSV.DPK_OSCOMMAND", line 28
    ORA-06512: at "CICCSV.DFN_mkdir", line 5
    ORA-06512: at line 8
    If you have any other idea or suggestion you're welcome. At the moment I've no solution for my problem.
    Thanks in advance.

  • Passing collection parameters from/to Oracle 8i stored procedure to/from Weblogic java program

    Environment- Oracle DB 8.1.7 (Sun) - JDBC OCI 8.1.7 - Application Server (WebLogic 6.0 or 6.1)QuestionHow to pass oracle collection data types from PL/SQL stored procedures to Weblogic java program as in/out stored procedures parameters. I am hitting oracle error 2006 unidentified data type trying to pass the following data types:-o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatumInformationAbout PL/SQL stored procedure limitation which only affects the out argument types of stored procedures calledusing Java on the client side. Whether Java methods cannot have IN arguments of Oracle 8 object or collection type meaning that Java methods used to implement stored procedures cannot have arguments of the following types:o java.sql.Structo java.sql.Arrayo oracle.sql.STRUCTo oracle.sql.ARRAYo oracle.jdbc2.Structo oracle.jdbc2.Arrayo any class implemented oracle.jdbc2.SQLData or oracle.sql.CustomDatum

    this is becoming a mejor problem for me.And are you storing it as a blob?
    Oracle doesn't take varchars that big.
    And isn't LONG a deprecated field type for Oracle?
    From the Oracle docs......
    http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/sql_elements001.htm#sthref164
    Oracle strongly recommends that you convert LONG RAW columns to binary LOB (BLOB) columns. LOB columns are subject to far fewer restrictions than LONG columns. See TO_LOB for more information.

  • Need help with BC4J/Struts application using a Stored Procedure

    Hi,
    I am doing a proof of concept for a new project using JDeveloper, Struts and BC4J. We want to reuse our Business logic that is currently residing in Oracle Stored Procedures. I previously created a BC4J Entity Object based on a stored procedure Using Oracle Stored Procedures but this stored procedure is a bit different in that it returns a ref cursor as one of the paramters. http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
    I tried the above method, but I am having some trouble with it. I keep getting the error ORA-01008: not all variables are bound when I test it using the AppModule tester.
    Here is the store procedure definition:
    CREATE OR REPLACE PACKAGE pprs_test_wrappers IS
    TYPE sn_srch_results IS REF CURSOR;
    PROCEDURE sn_srch_main_test
    (serial_num_in IN OUT VARCHAR2
    ,serial_coll_cd_in IN OUT NUMBER
    ,max_rows_allowed IN OUT NUMBER
    ,total_rows_selected IN OUT NUMBER
    ,message_cd_out IN OUT VARCHAR2
    ,query_results          OUT sn_srch_results
    END pprs_test_wrappers;
    And here is my code:
    package pprs;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle Business Components for Java.
    public class LienCheckImpl extends ViewObjectImpl
    * This is the PLSQL block that we will execute to retrieve the REF CURSOR
    private static final String SQL =
    "begin ? := pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
    public LienCheckImpl() {}
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will PRECEED the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    * If there are where-clause params (for example due to a view link)
    * they will be in the 'params' array.
    * We assume that if some parameter is present, that it is a Deptno
    * value to pass as an argument to the stored procedure.
    * NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
    * ---- but this parameter value should be oracle.jbo.domain.Number type.
    String serialNumIn = null;
    BigDecimal serialCollCdIn = null;
    BigDecimal maxRowsAllowed = null;
    BigDecimal totalRowsSelected = null;
    String messageCdOut = null;
    if (params != null) {
    serialNumIn = (String)params[0];
    serialCollCdIn = (BigDecimal)params[1];
    maxRowsAllowed = (BigDecimal)params[2];
    totalRowsSelected = (BigDecimal)params[3];
    messageCdOut = (String)params[4];
    storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
    serialCollCdIn,
    maxRowsAllowed,
    totalRowsSelected,
    messageCdOut));
    super.executeQueryForCollection(qc, params, numUserParams);
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overridden framework method.
    * The role of this method is to "fetch", populate, and return a single row
    * from the datasource by calling createNewRowForCollection() and populating
    * its attributes using populateAttributeForRow().
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
    populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
    populateAttributeForRow(r,2, rs.getString(3));
    populateAttributeForRow(r,3, rs.getString(4));
    populateAttributeForRow(r,4, rs.getString(5));
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    * Overridden framework method.
    * Return true if the datasource has at least one more record to fetch.
    protected boolean hasNextForCollection(Object qc) {
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    * Overridden framework method.
    * The framework gives us a chance to clean up any resources related
    * to the datasource when a query collection is done being used.
    protected void releaseUserDataForCollection(Object qc, Object rs) {
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    private ResultSet retrieveRefCursor(Object qc,
    String serialNum,
    BigDecimal serialColCd,
    BigDecimal maxRows,
    BigDecimal totalRows,
    String messageCd ) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Register the first bind parameter as our return value of type CURSOR
    st.registerOutParameter(1,OracleTypes.CURSOR);
    * Set the value of the 2nd bind variable to pass id as argument
    if (serialNum == null) st.setNull(2,Types.CHAR);
    else st.setString(2,serialNum);
    if (serialColCd == null) st.setNull(3,Types.NUMERIC);
    else st.setBigDecimal(3,serialColCd);
    if (maxRows == null) st.setNull(4,Types.NUMERIC);
    else st.setBigDecimal(4,maxRows);
    if (totalRows == null) st.setNull(5,Types.NUMERIC);
    else st.setBigDecimal(5,totalRows);
    if (messageCd == null) st.setNull(6,Types.CHAR);
    else st.setString(6,messageCd);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
    * Make this result set use the fetch size from our View Object settings
    rs.setFetchSize(getFetchSize());
    return rs ;
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Number
    private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new oracle.jbo.domain.Number(b) : null;
    catch (SQLException s) { }
    return null;
    I created the view object in expert mode so there is no entity object. Can someone help? I don't have much time left to finish this.
    Also, could I have done this from the Entity object instead of the view object by registering the ref cursor OUT parameter in handleStoredProcInsert()?
    Thanks
    Natalie

    I was able to get the input parameter by putting the following in my struts actions class
    vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
    The full code is:
    package mypackage2;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import oracle.jbo.html.BC4JContext;
    import oracle.jbo.ViewObject;
    import oracle.jbo.html.struts11.BC4JUtils;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class LienCheckView1QueryAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    BC4JContext context = BC4JContext.getContext(request);
    // Retrieve the view object instance to work with by name
    ViewObject vo = context.getApplicationModule().findViewObject("LienCheckView1");
    vo.setRangeSize(3);
    vo.setIterMode(ViewObject.ITER_MODE_LAST_PAGE_PARTIAL);
    // Do any additional VO setup here (e.g. setting bind parameter values)
    vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
    // default value for serialCollCd 1 is for Motor Vehicles
    vo.setWhereClauseParam(1,new oracle.jbo.domain.Number(1));
    // Default value for maxRows_allowed
    vo.setWhereClauseParam(2,new oracle.jbo.domain.Number(20));
    return BC4JUtils.getForwardFromContext(context, mapping);
    This doesn't always work properly though. The first time I press the query button, the SerialNum parameter is still null, however if I re-execute the query by pressing the query button again. It will work, and return the rows. I always have to query twice. Also the SerialNum attribute is set to a String in my view object, it is a varchar column in the database, but some serial number I enter give a "Error Message: oracle.jbo.domain.Number ". This happens even though the underlying BC4J is returning values for the query. I also get a "500 Internal Server Error java.lang.ClassCastException: java.lang.String on my View object's code at line 65 which is
    if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
    This is an input paramter to the oracle stored procedure that defaults to a Number value of 1.
    Any idea what the problem is? Here is the full code for my view object:
    package mypackage1;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle Business Components for Java.
    public class LienCheckViewImpl extends ViewObjectImpl
    * This is the PLSQL block that we will execute to retrieve the REF CURSOR
    private static final String SQL =
    "begin pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
    private BigDecimal totalRows = null;
    private String messageCd = null;
    private BigDecimal serialColCd = null;
    private BigDecimal maxRows = null;
    public LienCheckViewImpl() {}
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will *PRECEED* the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    * If there are where-clause params (for example due to a view link)
    * they will be in the 'params' array.
    * We assume that if some parameter is present, that it is a Deptno
    * value to pass as an argument to the stored procedure.
    * NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
    * ---- but this parameter value should be oracle.jbo.domain.Number type.
    String serialNumIn = null;
    BigDecimal serialCollCdIn = null;
    BigDecimal maxRowsAllowed = null;
    BigDecimal totalRowsSelected = null;
    String messageCdOut = null;
    if (params != null) {
    if (params.length>0) serialNumIn = (String)params[0];
    if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
    if (params.length>2) maxRowsAllowed = (BigDecimal)params[2];
    storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
    serialCollCdIn,
    maxRowsAllowed));
    super.executeQueryForCollection(qc, params, numUserParams);
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overridden framework method.
    * The role of this method is to "fetch", populate, and return a single row
    * from the datasource by calling createNewRowForCollection() and populating
    * its attributes using populateAttributeForRow().
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    //AddedByRegisNum
    populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
    System.out.println("AddedByRegisNum :" + rs.getBigDecimal(1));
    // OrigRegisNum
    populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
    System.out.println("OrigRegisNum :" + rs.getBigDecimal(2));
    // SerialNum
    populateAttributeForRow(r,2, rs.getString(3));
    System.out.println("SerialNum :" + rs.getString(3));
    // SerialNumDesc
    populateAttributeForRow(r,3, rs.getString(4));
    System.out.println("SerialNumDesc :" + rs.getString(4));
    // FlagExactMatch
    populateAttributeForRow(r,4, rs.getString(5));
    System.out.println("FlagExactMatch :" + rs.getString(5));
    // MessageCd
    populateAttributeForRow(r,5, messageCd);
    // TotalRows
    populateAttributeForRow(r,6, totalRows);
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    * Overridden framework method.
    * Return true if the datasource has at least one more record to fetch.
    protected boolean hasNextForCollection(Object qc) {
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    * Overridden framework method.
    * The framework gives us a chance to clean up any resources related
    * to the datasource when a query collection is done being used.
    protected void releaseUserDataForCollection(Object qc, Object rs) {
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    * Overridden framework method
    * Return the number of rows that would be returned by executing
    * the query implied by the datasource. This gives the developer a
    * chance to perform a fast count of the rows that would be retrieved
    * if all rows were fetched from the database. In the default implementation
    * the framework will perform a SELECT COUNT(*) FROM (...) wrapper query
    * to let the database return the count. This count might only be an estimate
    * depending on how resource-intensive it would be to actually count the rows.
    public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
    Object[] params = viewRowSet.getParameters(true);
    String serialNumIn = (String)params[0];
    BigDecimal serialCollCdIn = (BigDecimal)params[1];
    BigDecimal maxRowsAllowed = (BigDecimal)params[2];
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Register the fourth bind parameter as our return value of type NUMERIC
    st.registerOutParameter(4,Types.NUMERIC);
    * Set the value of the 3 bind variables to pass as arguments
    if (serialNumIn == null) st.setNull(1, Types.CHAR);
    else st.setString(1,serialNumIn);
    if (serialCollCdIn == null) st.setNull(2,Types.NUMERIC);
    else st.setBigDecimal(2,serialCollCdIn);
    if (maxRowsAllowed == null) st.setNull(3, Types.NUMERIC);
    else st.setBigDecimal(3, maxRowsAllowed);
    st.execute();
    System.out.println("returning value of :" + st.getLong(4));
    return st.getLong(4);
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    private ResultSet retrieveRefCursor(Object qc,
    String serialNum,
    BigDecimal serialColCd,
    BigDecimal maxRows) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Set the value of the bind variables
    System.out.println("SerialNumIn :" + serialNum);
    if (serialNum == null) st.setNull(1,Types.CHAR);
    else st.setString(1,serialNum);
    if (serialColCd == null) st.setNull(2,Types.NUMERIC);
    else st.setBigDecimal(2,serialColCd);
    if (maxRows == null) st.setNull(3,Types.NUMERIC);
    else st.setBigDecimal(3,maxRows);
    st.registerOutParameter(1, Types.CHAR); // serialNum
    st.registerOutParameter(2, Types.NUMERIC); // serialColCd
    st.registerOutParameter(3, Types.NUMERIC); // maxRows
    st.registerOutParameter(4, Types.NUMERIC); // totalRows
    st.registerOutParameter(5, Types.CHAR); // messageCd
    * Register the 6th bind parameter as our return value of type CURSOR
    st.registerOutParameter(6,OracleTypes.CURSOR);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(6);
    serialColCd = st.getBigDecimal(2);
    System.out.println("SerialColCd= " + serialColCd);
    maxRows = st.getBigDecimal(3);
    System.out.println("maxRows= " + maxRows);
    totalRows = st.getBigDecimal(4);
    System.out.println("totalRows= " + totalRows);
    messageCd = st.getString(5);
    System.out.println("messageCd= " + messageCd);
    * Make this result set use the fetch size from our View Object settings
    rs.setFetchSize(getFetchSize());
    return rs ;
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Number
    private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new oracle.jbo.domain.Number(b) : null;
    catch (SQLException s) { }
    return null;
    Natalie

  • PLSQL portlet - problem calling stored procedure -

    Good day folks. My portal version 10.1.2. I have a dynamic page with multiple rows. For simplicity, example here has two columns => id and value. The initial dilemma - The stored procedure specified in the action attribute of the <form> tag has to have parameters that match in name and count to the fields on the html form. But, the number of rows is variable on the form. I currently use pl/sql to generate the page. I have two forms in the html - form A has two static fields id and value, with an action attribute of the stored procedure I want to run. The second html form is form B. It has id_1, value_1, id_2, value_2, id_3, value_3 and so on with a variable number of rows. SO, when the user clicks the "Submit" button at the bnottom of the page, I call a javascript passing in the number of rows. I then loop through the Form B, and for each row of data, I do a submit of Form A. My goal is to run the stored procedure in the database for each row of data in Form B. I use Form A to accomodate the requirement that the stored procedure has to match in name and number the parameters inthe form.
    This is to avoid an update button on each row of data, also.
    The problem - in my javascript, I set the values of Form A to the values from Form B correctly. However, only the last rowis successful in running the procedure. For example, if I have 3 rows in Form B, I want to submit form A 3 times, but, it only seems to submit once for row #3. The weird thing is if I put an alert message after the document.formA.submit(); command, the stored procedure is successfully called for each row in form B, but when I remove the alert, only the last row successfully calls the procedure!
    Thanks in advance if anybody has any ideas -
    Kent

    Let's continue the example of 3 rows.
    It sounds like that you submit the form 3 times in quick succession, and so before the Action for Form A has had time to run and respond for the first row, the second row has been submitted, and therefore the web page will stop trying to display the results from the submit of Row 1 (by this I mean it'll stop the http request, if you do this quick enough then the back-end function won't run). Then the same thing happens to Row 2's submit when Row 3 starts.
    What it sounds like you need to do is to use only 2 parameters, but repeat them on the HTML page, when the submit is run it's passed to oracle as a type 'owa_util.vc_arr'. There is a more comprehensive solution to this problem in another thread:
    passing variable number of arguments in a stored procedure
    Please note though that you have to be careful of the situations where your form only has one row to submit to the oracle function, in this case the data type of the parameter will be a VARCHAR2 rather than a owa_util.vc_arr. The solution to this problem is to always have a an extra dummy parameter which is empty and you skip over it during your processing. (Thought I'd better include this information in case you ran into this problem).
    Hope this helps.
    Cheers,
    Ron.

  • How to call PL/SQL stored procedure with TWO or more arguments from URL?

    Hi all,
    does anybody know, how to call stored procedure with more than one argument?
    How to do this with one argument is known -
    <img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#" width="70" height="80" alt="No Picture">
    But if I need to call procedure with two formal parameters? And need to pass through URL, for example, two page item values?

    Just separate with an "&". Using your previous example, I'll add i_name and i_type:
    <img src="#OWNER#.retreive_img_data?i_id=#IMG_ID#&i_name=somename&i_type=jpg" width="70" height="80" alt="No Picture" />
    Tyler

  • Too many arguments for stored procedure call

    I have a stored procedure with 34 arguments, including the return value. I am trying to call it from java using JDBC thin drivers (jdk11, oracle815), but I get the "wrong number or types of arguments" error message. JDBC-OCI fails also. I saw a reference in this discussion group to there being a limit of 32 arguments for stored procedure calls from jdbc (posted 6/29/99). Is there such a limit? If so, is there a fix or workaround? If there is not a limit, how can I determine which argument is causing the problem?
    Many thanks.
    Mike
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'PUT_CHECK'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.jav
    a)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch(OracleStatement
    .java)
    at oracle.jdbc.driver.OracleStatement.doExecute(OracleStatement.java)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
    nt.java)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
    edStatement.java)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
    ement.java)
    at metris.quickcheck.database.DS1.main(DS1.java:79)
    null

    I must confess I still don't understand your problem. By rows ...
    I have an sql that recodes a column and has 1450 rows. This doesn't work
    although when I use the same with less rows 40-60 it works.... do you mean rows in the table or elements in the CASE() statement ?
    From the 9i SQL Reference:
    " The maximum number of arguments in a CASE expression is 255, and each WHEN ... THEN pair counts as two arguments. To avoid exceeding the limit of 128 choices, you can nest CASE expressions. That is return_expr can itself be a CASE expression."
    According to the 10g docs the limit is the same there.
    Cheers, APC

  • Sqlbase - how to run a stored procedure with SYSDATE argument

    Hi, everyone!
    I'm trying to execute a stored procedure :
    cstmt = con.prepareCall("{ call PR_MYPROCEDURE(?, SYSDATE-1, SYSDATE) }");
    cstmt.setInt(1,1);And i get and SqlException - java.sql.SQLException: prepareCall(): An unexpected character 'S' found.
    Is there any way to pass a SYSDATE like argument?

    the problem that for sqlbase current date function is SYSDATE'sqlbase' the database?
    I couldn't ensure that the syntax that you posted looks correct but it seems possible.
    That would suggest there is a driver problem.
    Best I can suggest is modify the proc so it expects nulls for two parameters and then it creates the expressions that you are passing. Or create java Timestamp values and pass those.

  • Data block based on stored procedure with  input arguments

    Hi,
    I am able to create a data block based on stored procedure.
    but I want that procedure to take input arguments as well and I am facing the issue while setting the value for that input arguments from another block item.
    Please somebody help, How to set the value for input argument from another control block- item?.(Note :Data block is based on the stored procedure)
    Thanks in Advance,
    Anandan Muthukannan

    I did exactly the same way you mentioned.
    But while building the form, The call to the procedure in 'QUERY-PROCEDURE' trigger has been modified like this way
    procedure_name(qp_data,':BLOCK.ITEM');
    so in procedure i am getting the value as ':BLOCK.ITEM' not the expected value.

  • Calling a stored procedure with argument as column name

    hi
    i am calling a stored procedure mapping_audit_errors_inserts
    whose definition is as follows
    PROCEDURE mapping_audit_errors_inserts (
    in_ma_seq_id IN ETL_MAPPING_AUDIT_ERRORS.ma_seq_id%TYPE,
    in_etl_stage IN ETL_MAPPING_AUDIT_ERRORS.etl_stage%TYPE,
    in_sqlerrcode IN ETL_MAPPING_AUDIT_ERRORS.sqlerrcode%TYPE
    IS
    BEGIN
    mapping_audit_ora_errors (in_ma_seq_id,
    in_etl_stage,
    in_sqlerrcode,
    get_error_message (in_sqlerrcode)
    END;
    now i need to call this procedure as
    mapping_audit_errors_inserts(MA_SEQ_ID.currval,1,v_error_code)
    [ v_error_code:=SQLCODE;]
    it is giving error as
    PLS-00201: identifier 'MA_SEQ_ID.CURRVAL' must be declared
    can anyone calrify me on this.
    Thanks

    Anwar is likely correct about the reason for your error. The other possibility is that the owner of the procedure calling mapping_audit_errors_inserts does not have SELECT on the sequence granted directly to them.
    However, even after creating the sequence, if the session calling the procedure has not got a value from the sequence prior to trying to use CURRVAL, you will get:
    SQL> CREATE PROCEDURE p(p_id IN NUMBER) AS
      2  BEGIN
      3     DBMS_OUTPUT.Put_Line('ID is '||p_id);
      4  END;
      5  /
    Procedure created.
    SQL> DECLARE
      2     l_no NUMBER;
      3  BEGIN
      4     SELECT ma_seq_id.CURRVAL INTO l_no
      5     FROM dual;
      6     p(l_no);
      7  END;
      8  /
    DECLARE
    ERROR at line 1:
    ORA-08002: sequence MA_SEQ_ID.CURRVAL is not yet defined in this session
    ORA-06512: at line 4And, just to reinforce Anwar's point about selecting it into a variable, if you try to pass CURRVAL to a procedure, you will get:
    SQL> DECLARE
      2     l_no NUMBER;
      3  BEGIN
      4     SELECT ma_seq_id.NEXTVAL INTO l_no
      5     FROM dual;
      6     p(ma_seq_id.CURRVAL);
      7  END;
      8  /
       p(ma_seq_id.CURRVAL);
    ERROR at line 6:
    ORA-06550: line 6, column 16:
    PLS-00357: Table,View Or Sequence reference 'MA_SEQ_ID.CURRVAL' not allowed in
    this context
    ORA-06550: line 6, column 4:
    PL/SQL: Statement ignoredTTFN
    John

  • Problem in calling a stored procedure by passing few arguments.

    Hi Friends,
    I am converting a Purchase module which is developed in forms3. In that Copy PO is one page which uses to copy previously generated PO. Now I have a situation that coping a record of few tables into same tables by modifying few columns. First I need to display one table record in a page which is read only and same data have to be displayed in the same page which can be modify. Depending on the changes now i need to insert a new record into the table and remaining related table data should be copied as well. This should be done by using stored procedure.
    while I trying this I am getting following error.
    1.     JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=Error : java.sql.SQLException: ORA-06550: line 1, column 16: PLS-00201: identifier NUM must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    2.     Error : java.sql.SQLException: ORA-06550: line 1, column 16: PLS-00201: identifier NUM must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    3.     JBO-25009: Cannot create an object of type:java.lang.Number with value:79
    Please Help me to solve this, I will be waiting for your valuable reply.(Email :[email protected])

    Probably problem is inside PL/SQL procedure. PLS-00201: identifier NUM must be declared indicates for this.

Maybe you are looking for

  • Lightroom 1.1 Import Stall and Poor Performance: a solution?

    My lightroom is extremely slow (unusable) when trying to import approx. 1000 JPGs into a brand new, fresh catalog. I've got a Intel Mac 2.33Gz MBP w/2G RAM running 10.4.10 and lots of free disk space. A workaround?: As soon as I select "Quick Collect

  • My downloaded music wont go into my library!

    i bought it all, but when i try to download it, it wont go to my library! it just... disappears! im not using my original computer i started my ipod with, could that be a problem?

  • Problem with logic OR

    im trying to use || or in my program and it does things even if one of the things is not true. if((ExamSystemLocked.equals("Unlocked")) || (CourseworkSystemLocked.equals("Unlocked"))) even if ExamSystemLocked is set to "Locked" it will still carry ou

  • Can't get sound to work - no /dev/dsp !!!

    I could really do with some help here, this is the first time I have tried to get sound working under linux. I am using a Abit VT6X4 board with on-board sound (VT82C686A) AC97 compliant chipset. I am using Kernel 2.6 which uses the config from the 2.

  • Linking of Main and Sub Reports

    Hi, We have a requirement to integrate all the crystal reports (say 10 nos) into one single main report for the statutory purpose as per the client requirement. Basically client would like to view all these ten reports in single file by export them i