PreparedStatement - unknown number of parameters

Help!
I have to use PreparedStatement to access an oracle database. This statement should be able to handle a number of values for one parameter. For example the parameter is area and there is a number of counties the user can choose...
So i have a query statment like
select population from populatn where area IN('BEAVER', 'CACHE'......)
Here how do I use preparedstatement?
Sue

Yeah, that's always what they mean when they ask the
question. The answer is still no.right. when you have a variable number of parameters than you don't have a prepared statement anymore.
however if you want to get information about a prepared statement's parameters you can use getParameterMetaData method of PreparedStatement new in 1.4.

Similar Messages

  • Jsp unknown number of parameters; seriously need an idea

    i have a jsp page where i query for a list of items in the DB and list them using forEach
    so it looks like the following
    Product ID | Price | TextField where the user can enter how many they want
    Product ID | Price | TextField where the user can enter how many they want
    Product ID | Price | TextField where the user can enter how many they want
    and finally theres a buy button on the bottom where it sends the info to servlet to figure out how many much of each product is purchased and outputs an invoice
    how do i handle this when i don't know the number of products to start out with?
    I won't have too many products; usually 5 to 8 at a time
    how should i set up my INPUT NAME and VALUES?!
    so i can post to my servlet and have it handle it easily?

    hi friend,
    when u display the products i think u will take same form fields
    like if u have 10 products while displaying in the page u will take the array of form fields right...
    when u submitt such page and move on to the other page for inserting the information
    here u check which productid is checked .like
    String productId[] = request.getParameterValues("productId");
    String price[] = request.getParameterValues("price");
    String quantity[] = request.getParameterValues("quantity");
    note that the form field name which u declare in the display of products page will be productId,price,quantity respectively.
    now u check like this
    for(i=0;i<productId.length;i++)
    if (productId==null)
    break;
    else
    proid=productId[i];
    price=price[i];
    quant=quantity[i];
    // here call the insert method of the java program which u write
    I Think this will help u
    the main problem with this coding is if u select 10 products u will go to database 10 times if u want to go to database only once pass the String Array of productId,Price and Quantity as a parameter to the insert method and check the selected product and insert.

  • Wrong number of parameters exception when using PreparedStatement

    Hi,
    I'm getting Wrong number of parameters exception when using a prepared statement. It's very weird. The code is:
    sqlstmt="update blah1 set blah2=? where blah3=?";
    myps = Conn.prepareStatement(sqlstmt);
    myps.setString(1, p1);
    myps.setInt(2, p2);
    myps.executeUpdate(sqlstmt);
    The error is:
    SQLException: [IBM][CLI Driver] CLI0100E Wrong number of parameters. SQLSTATE=07001:07001
    Could someone please help? Thanks
    Mahdad

    Hi and thanks for the reply.
    Actually this is the try block...
    The variable's defintions are correct.
    PreparedStatement myps;
    try {
    sqlstmt="update blah1 set blah2=? where blah3=?";
    myps = Conn.prepareStatement(sqlstmt);
    myps.setString(1, blah4);
    myps.setInt(2, blah5);
    myps.executeUpdate(sqlstmt);
    catch (SQLException e) {
    System.out.println("SQLException: " + e.getMessage() + ":" + e.getSQLState());
    blah6++;

  • Number of parameters unknown....

    Hi Everyone
    I am building my form ( question_form) depending on the results of my query. This makes it to be difficult to know the number of parameters that will be submitted when the user clicks on the submit button. Save_form is the name of the procedure that will store (insert into a table) the results of question_form when the user submits the form. I experience the problem calling save_form procedure since well I don’t know the number of parameters that it will have to receive. I thought of using the array but I am clueless of where to start……
    Can anybody save my life on this regard.
    Message was edited by:
    Tshepza

    ... I don’t know the number of parameters that
    it will have to receive. I thought of using the array
    but I am clueless of where to start……
    Can anybody save my life on this regard.
    A good place to start is this:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm
    and you can follow up with this:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/collections.htm#i26701
    HTH
    pratz

  • Showing dynamic and unknown number of images in SSRS report

    I am using SSRS 2008.  I need to display an unknown number of unspecified images on the report.
    Basically I have a webpage, where the user selects a specific ID (ex. 24) from a dropdown and then click "View Report".
    The report should then display any images, associated with that ID.  The only thing I know about the images, is the path to where the images are stored.  The path is kept in a database, so I should be able to retrieve the path ok.
    But then how do i get the report to display the images, when I do not know the name or number of images?
    Please help.

    Hi dukie4lif,
    According to your description, you have a report to display images selected by users. Now your issue is, the users select a specific ID to get images, but you only have the path of images stored in your database. Is my understanding correct?
    For your requirement, if the users want to get images by selecting a specific ID, this ID must be stored in database and associated with the path of those images. Otherwise the database can never query any records with this ID if it doesn’t have any ID stored.
    Now we need to go to your database, create one more table or add one more column in the table which have your path stored to store those IDs, and let them associated with those path. Use a parameter in this report for users selecting IDs. Then your goal will
    be achieved.
    Reference:
    Report Parameters (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou (Pactera)

  • Wrong number of parameters

    Whats wrong with this code?
         public void updateProduct(String id, String name, String description, String cost){
              Connection conn = null;
              DataSourceManager dataSource = new DataSourceManager();
              conn = dataSource.getConnection();
              PreparedStatement stmt;
              try {
                   String updateString = "UPDATE PRODUCT SET PRODUCT_NAME = ?, DESCRIPTION = ?, COST = ? WHERE PRODUCT_ID LIKE ?";
                   stmt = conn.prepareStatement(updateString);
                   stmt.setString(1, name);
                   stmt.setString(2, description);
                   stmt.setDouble(3, Double.parseDouble(cost));
                   stmt.setString(4, id);
                   stmt.executeUpdate(updateString);
                   conn.commit();
              } catch (SQLException sqle) {
                   sqle.printStackTrace();
    I get:
    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0100E Wrong number of parameters. SQLSTATE=07001
         at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:256)
         at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:193)
         at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:444)
         at COM.ibm.db2.jdbc.app.DB2Statement.execute2(DB2Statement.java:435)
         at COM.ibm.db2.jdbc.app.DB2Statement.executeUpdate(DB2Statement.java:381)
         at com.ibm.ejs.cm.cache.CachedStatement.executeUpdate(CachedStatement.java:132)
         at com.ibm.ejs.cm.proxy.StatementProxy.executeUpdate(StatementProxy.java:190)
         at com.bright.coffeeplease.persistence.ProductPersister.updateProduct(ProductPersister.java:114)
         at com.bright.coffeeplease.product.UpdateProductServlet.doGet(UpdateProductServlet.java:24)
         at com.bright.coffeeplease.product.UpdateProductServlet.doPost(UpdateProductServlet.java:12)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
         at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
         at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
         at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
         at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
         at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
         at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:403)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:227)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:98)
         at com.ibm.servlet.engine.webapp.InvokerServlet.service(InvokerServlet.java:267)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
         at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
         at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
         at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
         at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
         at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
         at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:403)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:227)
         at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:98)
         at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67)
         at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:123)
         at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
         at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:122)
         at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
         at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
         at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313)
         at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242)
         at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)

    You don't want to call
    stmt.executeUpdate(updateString)
    You just want to call executeUpdate() - the prepared statement already knows what you're trying to do.
    Hope this helps.
    Incidentally, did you really mean "... WHERE PRODUCT_ID LIKE ?" rather than "... WHERE PRODUCT_ID = ?"

  • Dialing number phone prompts for To:UNKNOWN NUMBER instead of Enter Code

    I have successfully Applied FAC (force authorization code), after dialing number phone prompts for To:UNKNOWN NUMBER instead of ENTER AUTHORIZATION CODE to complete the call, Also I would like to extend the delay for few more seconds so user can get enough time to enter code before busy tone.

    Dear, I am unable to find any option which may let me configure the PROMPT from SERVICE PARAMETERS => Cisco Call Manager ...., which must be set ENTER AUTHORIZATION CODE whenever user dials long distance call. We have CCM 4.1.2

  • Add Listener to Unknown Number of JMenuItems

    How can I add an ActionListener to each JMenuItem by cycling through an unknown number of menu items?
    I have a program that prompts the user for a database, then creates a JMenu of table names based on whatever database the user selects.
    This means that I don't know the table names or number of tables that will be added to the JMenu.
    I need to add an ActionListener to EACH JMenuItem. The problem is that I am only able to select one table from the menu. Subsequent menu clicks (on different table names) have no affect on the output.
    Here is an excerpt of my code:
    ResultSet rs = md.getTables(null, null, null, types);
    while (rs.next()) {
    tables.add(rs.getString("table_name"));
    for (Iterator i = tables.iterator(); i.hasNext(); )
    String table = (String) i.next();
    JMenuItem mi = new JMenuItem(table);
    j1.add(mi);
    mi.addActionListener(this);
    [END CODE]
    Thanks for any help you can give!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    I got it. It turns out that I WAS setting the listeners correctly. My additonal output was "hidden" in the window. I found it by pure luck when I expanded the window size.
    I added a line to remove all components from the JPanel before adding a new one and this "refresh" worked.
    Thanks fot the help anyway! It is greatly appreciated.

  • Error executing CFC. Parameter index out of range (2 number of parameters, which is 1)

    Hi,
    My CFC component is defined as:
    <cffunction name="updateNote" output="false" access="remote"  returntype="void" >
         <cfargument name="notedetails" required="true" type="string" >
         <cfargument name="notename" required="true" type="string" />
         <cfquery name="qupdateNote" datasource="notes_db">
               UPDATE
                   notes
               SET
                   notes.notedetails=<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notedetails#">,
               WHERE
                   notename="<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.notename#">"
        </cfquery>
    </cffunction>
    In Flash builder when I test the operation I get this error:
    "There was an error while invoking the operation. Check  your server settings and try invoking the operation again.
    Reason:  Server error Unable to invoke CFC - Error Executing Database Query. Parameter  index out of range (2 > number of parameters, which is 1)."
    Im really quessing that this is something small but right now its causing me to pull my hair out of my head!! Argg. Tried a bunch of things but I know thik im stuck.
    Help would be very very appreciated.
    Thanks

    Create test.cfm along these lines:
    <cfset myObj = createObject("component", "dotted.path.to.cfc.file")>
    <cfset myResult = myObj.myMethod(arg=value1, etc)>
    <cfdump var="#myResult#">
    Or, really, you could just browse to this:
    http://your.domain/path/to/your.cfc?method=yourMethod&arg1=value1 [etc]
    Although I dunno which of those two approachs will give you a better error message (indeed, it might be the same).
    Try both.
    Adam

  • Uploading a text file with unknown number of  texts

    Hi ,
    i have a flat file with around  10,000 record's.
    each material number  followed by  different  lengths & unknown number of text's separated by delimiter '$',
    that need to be saved using save_text function module.
    the file is as follows, 
    record 1 :     material1$text1$text2$text3
    record 2 :     material2$text1$text2$text3$text4$text5$text6$.....
    record 3 :     material3$text1$text2$text3$text4$text5
    record 4:      material3$text1
    - - - - - - - - - - - -  so on ....
    i created the following  structure ,  to split and save each text separated by '$'  , to save in TLINE  of save_text function module.
    types : begin of ty_file,
                  matnr type mara-matnr,
                  text1 type string,
                  text2 type string,
                  text3 type string,
                  text4 type string,
                  text20 type string,
               end of ty_file.
    i have uploaded the file and saved in table  it_file type ty_file.
    loop it_file into wa_file.
       split wa_file at '$' in to matnr text1 text2 text3 text4 ....... so on.
    endloop.
    please, suggest me an alternate way to reduce the code, instead of creating a structure like above, so that each splitted text
    stores in a single variable and is passed to TLINE of corresponding material, in save_text function module
    thanks
    viki

    Hi,
    The flat file contains , material No. followed by it's text , each text sepearted by '$' symbol.
    For each material  i have to get all lines of text, and passed to tables paramter of save_text.
    The Number of text' for each material is varying.
    Please kindly suggest me , how many variables i need to create to hold each splitted text and store it in Tline
    I wrote the below program assuming that the material number has  maximum of 20 texts, it's working fine. But, what if the number of texts exceeds 20.
    file :
    4907507$ Druckrolle$ Durchmesser: 218 mm$ Länge: 750 mm$ Rollenwerkstoff: 1.4301/1.4541$ Oberfläche: gummiert$ Stärke Gummierung: 10 mm$ Näscher    E 71224$$$$$$$$$$$$$$                              
    1149598$ Tragrolle$ mit Stützringen$ Norm: ähnlich DIN 22112$ Durchmesser: 89 mm$ Mantellänge: 800 mm$ Form der Achsenden: A2$ Achsdurchmesser: 25 mm$ Achsanflachung: SW 18$ Einlegelänge: 808 mm$ Achslänge: 834 mm$ Lagerbezeichnung: 6305$ Anzahl Stützringe Form A: 6$ Anzahl Stützringe Form B: 4$ Anordnung links: 4$ Anordnung mittig: 6$ Anordnung rechts: 4$ Qualität Stützringe: N$ Durchmesser Stützringe: 159 mm$ Anzahl Zwischenhülsen: 7$ Anzahl Schlussscheiben: 2$ Erbö   3111.800.05.68                                                                      
    file upload
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          static    = 'X'
        CHANGING
          file_name = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME            = gd_file
          FILETYPE            = 'ASC'
         HAS_FIELD_SEPARATOR = 'X'
         HAS_FIELD_SEPARATOR = '$'
        TABLES
          DATA_TAB            = It_data.
      loop at it_data into wa_data.
        split wa_data-line at seperator into matnr_txt text1 text2 text3 text4 text5
                                                   text6 text7 text8 text9 text10 text11
                                                   text11 text12 text13 text14 text15
                                                   text16 text17 text18 text19 text20.
        move matnr_txt to wa_material-matnr.
        move text1 to wa_material-text1.
        move text2 to wa_material-text2.
        move text20 to wa_material-text20.
        append wa_material to it_material.
        clear wa_material.
      endloop.
      loop at it_material into wa_material.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text1.
        APPEND WA_LINE TO IT_LINE.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text2.
        APPEND WA_LINE TO IT_LINE.
        WA_LINE-TDFORMAT = '*'.
        WA_line-TDLINE = wa_material-text20.
        APPEND WA_LINE TO IT_LINE.
        G_THEAD-TDNAME   = wa_material-matnr. " material number
        G_THEAD-TDID     = pa_id.                           "  'GRUN',
        G_THEAD-TDSPRAS  = pa_langu.                "  EN
        G_THEAD-TDOBJECT = pa_obj.                   "  MATERIAL
        CALL FUNCTION 'SAVE_TEXT'
          EXPORTING
            CLIENT                           = SY-MANDT
            HEADER                        = G_THEAD
            SAVEMODE_DIRECT     = 'X'
          TABLES
            LINES           = IT_LINE
          clear : wa_line, g_matnr.
          refresh it_line.
      endloop.
    Edited by: jvsvijay on Jul 28, 2011 12:51 PM
    Edited by: jvsvijay on Jul 28, 2011 12:53 PM
    Edited by: jvsvijay on Jul 28, 2011 12:55 PM

  • Is there a max number of parameters that can be passed to a C function in test stand v. 1.0.1

    I have had an issue with test stand version 1.0.1 (yes, I know; it's quite old) and calling a C function thru an action step. when I call this function with 18 parameters, it seems to hang. I have called a function with 16 and it seems to work. Is this a limit of the software? I am calling the function from a windows DLL that we've created. When I try to pull the function from the dll into test stand I also get a { error...but I get that in the other function's call and it seems to work fine. Any ideas?

    ok, upon re-reading what I posted I can clearly see your confusion. haha. I think there are two separate issues.
    1) Are there a maximum number of parameters one can use when calling a C function from a DLL? Yes, i'm trying to call a C function from test stand.
    2) when I select the "module" tab, and select which DLL contains my function, the prototype has no information associated with it (by clicking the reload prototype button). I'm not sure why, as I'm using a declspec to send the function information out of the dll, but that's another topic. So I click on the source file tab and point the window to the .cpp of my function (within the DLL's project workspace) and when it begins to parse the file, I get an error about mis-matched curly brackets and if I wish to continue, and skip the rest of the parsing.
    I click "OK" and when I go back to the module tab, I am able to see all my functions, along with the parameters in the drop down menu below. I fill in all the parameters and everything looks ok; no syntax errors, or anything else seemingly suspicious. I then run my test stand code and when I get to the step which calls this function, the system hangs and cannot proceed.
    Any thoughts as to what might cause these issues? 

  • Calls from cucm to CME not working-unknown number

    hi all
    we have cucm 9.1 and gateway 2911 on the side A and on the side B we have uc540 , we have configured tunnels between 2911 and uc540, calls from cucm SideA to uc540 Side B is ok and working fine. now we have one 9951 phone which gets ip from uc540 (side B) and tftp is our cucm IP.9951 phone is registered in cucm and calls from cucm to that 9951 phones are working fine. now problem is call is one sided between uc 540 local extension and ip phone 9951.
    9951 which is registered on cucm can call uc 540 user  but spa 504 phone which is registered on uc540 cant call to cisco 9951 phone gets error "unknown number"
    i am attaching debug voice ccapi inout with this
    kidnly help me to solve the issue ASAP

    here is show voice register all.i am surprised to see dial peer 20002 but there is no dial peer like that i dont know where its getting this dial peer 20002.extension 2002 is registered with my call manager.
    Router#sh voice register all
    VOICE REGISTER GLOBAL
    =====================
    CONFIG [Version=8.6]
    ========================
      Version 8.6
      Mode is srst
      Max-pool is 0
      Max-dn is 0
      Outbound-proxy is enabled and will use global configured value
      Security Policy: DEVICE-DEFAULT
      Forced Authorization Code Refer is enabled
      timeout interdigit 0
      network-locale[0] US    (This is the default network locale for this box)
      network-locale[1] US
      network-locale[2] US
      network-locale[3] US
      network-locale[4] US
      user-locale[0] US    (This is the default user locale for this box)
      user-locale[1] US
      user-locale[2] US
      user-locale[3] US
      user-locale[4] US   Active registrations  : 0
      Total SIP phones registered: 0
      Total Registration Statistics
        Registration requests  : 0
        Registration success   : 0
        Registration failed    : 0
        unRegister requests    : 0
        unRegister success     : 0
        unRegister failed      : 0
        Attempts to register
               after last unregister : 0
        Last register request time   :
        Last unregister request time :
        Register success time        :
        Unregister success time      :
    VOICE REGISTER DN
    =================
    VOICE REGISTER POOL
    ===================
    Router#

  • Passing Variable Number of Parameters to Cobol Stored Procedure

    Hi. I have a web front end that needs to access several different tables via Cobol stored procedures. It seems simple enough to call the stored procedures straight away (DAO Pattern perhaps?) but my boss is insistent on having an intermediate Cobol program that decides which table to access. I think he at a bigger picture than I can see.
    The problem lies in the number of parameters that need to be passed to the stored procedures; some need 3, others needs 5, a few need 4. The only two solutions that I can think of are to pass EVERYTHING (we're talking 50 parameters or so) to the intermediate stored procedure and then pulling only what is needed from that data set to access the desired table. Solution number two involves passing everything to a temp table and then pulling what is needed from it. The former solution seems a little cleaner but still involves passing a lot of parameters. If Cobol could handle some sort of dynamic memory allocation (Vector) there seems to be a possible solution there. Though, as far as I know, that isn't possible.
    Any ideas are much appreciated.
    Thanks in advance,
    Chris

    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.

  • Variable number of parameters in a procedure

    Hello !
    I have a form in a procedure with dynamic inputs type "checkbox" (one checkbox by record of a table).
    The action of the form is another procedure. There is a variable number of parameters (depending on checked inputs).
    How can I do for retreiving these variable data within a single variable in my second procedure ?
    Thanks for help and sample
    null

    What u can do is use Javascript and pass all the selected checkbox Ids as a dilimited string..which u can read in second procedure and can perform appropriate action. for example if you have check box named as chk1,chk2,chk3,chk4 n so on..
    now if chk1,chk3,chk4 are checked then pass this string in the hidden field "1|3|4"which is a |(pipe) delimited string..

  • How to create a dynamic query in which I can vary number of parameters

    I am writing a JDBC connector. I want to write a dynamic query in that. The query should be able to proceed variable number of parameters and also in the where clause the and/or/like parameters I want to place dynamically.
    I can't write store procedures as we just have read only access to Database so I want to do it through query only.
    Please help me out in doing that as I am not able to proceed further without it ...

    Hi,
    Have a luk at :placeholder for IN condition in database adapter

Maybe you are looking for