Select into using  parameters versus real values

Can anyone please explain how PL/SQL operates in a condition where you pass in a value versus
hardcoding it ? When it's hard coded, I get a 1 row response and the correct information
When I pass in the value through the call statement, I get exact fetch returns more rows than requested number of rows. ORA - 01422
Here is the command line pl/sql --
declare
n_count number;
aa char(255);
bb char(255);
cc char(255);
begin
select vol_id, orig_id, incoming_msg
into aa, bb, cc
from
table_name where file_name ='123456'
and incoming_msg ='I';
n_count :=sql%rowcount;
DBMS_OUTPUT.Put_line ('sqlcode is' || sqlcode);
end;
sqlcode is 1.
The above returns one row ... which is what I want
Now if I wrap it to pass in the file_name That is where I get the fetch returns more rows.
create or replace procedure test(file_name IN VARCHAR2)
authid CURRENT_USER
IS
n_count number;
aa char(255);
bb char(255);
cc char(255);
begin
select vol_id, orig_id, incoming_msg
into aa, bb, cc
from
table_name where file_name =file_name
and incoming_msg ='I';
n_count :=sql%rowcount;
DBMS_OUTPUT.Put_line ('sqlcode is' || sqlcode);
end;
procedure is successfully created..
then
Call TEST('123456');
error at line 1p
ORA-10422: exact fetch returns more than requested number of rows
ORA -06512 at TEST, line 17
Line 17 is the select vol_id, orig_id, incoming_msg
into aa, bb, cc
so what is it about select and into in a procedure that causes this error ... AND how to get around it ?
Many Thanks in advance.

sgonos wrote:
Can anyone please explain how PL/SQL operates in a condition where you pass in a value versus
hardcoding it ? When it's hard coded, I get a 1 row response and the correct information
When I pass in the value through the call statement, I get exact fetch returns more rows than requested number of rows. ORA - 01422
Now if I wrap it to pass in the file_name That is where I get the fetch returns more rows.
create or replace procedure test(file_name IN VARCHAR2)
authid CURRENT_USER
IS
n_count number;
aa char(255);
bb char(255);
cc char(255);
begin
select vol_id, orig_id, incoming_msg
into aa, bb, cc
from
table_name where file_name =file_name
and incoming_msg ='I';
n_count :=sql%rowcount;
DBMS_OUTPUT.Put_line ('sqlcode is' || sqlcode);
end;
procedure is successfully created..
then
Call TEST('123456');
error at line 1p
ORA-10422: exact fetch returns more than requested number of rows
ORA -06512 at TEST, line 17
Line 17 is the select vol_id, orig_id, incoming_msg
into aa, bb, cc
so what is it about select and into in a procedure that causes this error ... AND how to get around it ?Perhaps this part...
where file_name =file_namewhich of course will be true for every row.
I would suggest you rename your parameter to p_file_name and have the SQL read:
where file_name = p_file_name

Similar Messages

  • Using parameters like: -Dname=value w/ WL command-line (startWeblogic)

    Hello BEA/WL gurus and users, I have the dubious task of including information to be passed to a servlet deployed as a .war on my BEA/WL 92 instance. I would like to include a so-called minus D argument like the following when I start up my WL instance:
    startWeblogic.(cmd|sh) -Dname=value
    Then when the servlet is running I would like to extract the value from the name using some weblogic.jar gadgetry.
    Does anything exists for doing the proposed above?
    Please advise, David. (rants and raves are OK too).

    Generally, the cleaner way to provide application parameters for web applications is to modify the web.xml to add parameters, or create a deployment plan to modify the web.xml (although I think the latter only works to modify existing parameters to different values). These strategies isolate the application changes to within the application itself, as opposed to changing the entire server environment.
    That being said, if you use the NodeManager to start your servers, if you edit the server config in the admin console and go to the "Server Start" tab, you can edit the "Arguments" field to add your property setting. If the property value has spaces in it, you'll have to add quotes around the value.

  • Oracle 7.3.4 select into using long datatype

    How do I copy values using plain SQL
    Scenario
    Table T1 (C1 int, C2 long)
    Table T2 (C1 int, C2 long)
    T1 has the following value in the respective columns
    C1 = 1
    C2 = ('A','B')
    Now I tried the following
    Insert into T1 select * from T2 ;
    This is Illegal
    How do I workaround and Is there a workaround ??
    Thanks in Advance
    null

    Hi Gopal,
    The earliest version (if Client & Server) Oracle supported on Windows 2000 was 8.1.6, now de-supported.
    Currently certified are 8.1.7 and 9.0.1.
    7.3.4 is long out of support, and there have been some fairly radical changes to Oracle and the Oracle network products since then, so I'd not be surprised it doesn't work.
    Bob

  • Select-options and parameters

    hi,
    In How many ways we can define select-options and parameters.

    hi uday,
    Usually we use PARAMETERS for single value input and
    SELECT-OPTIONS is used to give a range of input values for a single field
    SELECT-OPTIONS implicitly consists of internal table with fields
    OPTIONS
    LOW
    HIGH
    SIGN
    eg:
          DATA: G_VBELN TYPE VBAK-VBELN.
          SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
          PARAMETERS : P_VBELN LIKE VBAK-VBELN.
          SELECT-OPTIONS: S_VBELN FOR G_VBELN.
          SELECTION-SCREEN END OF BLOCK B1.
       o/p:
              P_VBELN: _________________.
             S_VBELN:___________ TO  ____________.
    reward if helpful
    regards.
    shashikanth naram.

  • Using parameters in a select query sometimes not working

    I use parameters throughout my code - usually without problem, but for some reason in one case it does not return a result. When I modify the querystring to contain the value instead of using parameters it works. Is it because I'm secting a clob? or is it because I'm using a 9i ODP.net dll against a 10g database? this is c# 2.0
    here's the source code that does not work for me - REQUEST_DATA is a clob:
        public String loadRequest(String PSRNumber)
            String returnVal = null;
            ConnectionStringSettings connectionInfo = System.Configuration.ConfigurationManager.ConnectionStrings["Scribe"];
            OracleConnection myConnection = new OracleConnection();
            String strSQL = "select PSR, REQUEST_DATA from stats.request where PSR = :PSR";
            try
                myConnection.ConnectionString = connectionInfo.ConnectionString;
                OracleCommand cmd = new OracleCommand(strSQL, myConnection);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("PSR", OracleDbType.Varchar2).Value = PSRNumber;
                myConnection.Open();
                OracleDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                    returnVal = dr.GetOracleString(dr.GetOrdinal("REQUEST_DATA")).ToString();
                else
                    returnVal = null;
                dr.Dispose();
                cmd.Dispose();
            catch (OracleException ex)
                printError(ex.Message);
            finally
                myConnection.Close();
                myConnection.Dispose();
            return returnVal;
        }when I replace the line generating the sql, and remove the lines pertaining to parameters it works:
    String strSQL = String.Format("select PSR, REQUEST_DATA from stats.request where PSR = {0}", PSRNumber);
    I'm fine just using this as a workaround, but I need an explanation why the other does not work - I prefer to use parameters.
    Message was edited by:
    user633546

    I figured it out. thank you for your help in pointing me in the right direction.
    the problem was there was a trailing space in the data.
    when the data for that table is numeric for every record, the query allows me to leave out the single quotes. Trailing spaces do not seem to cause the database to see it as non-numeric - leaving out the quote still finds the record even if there is a trailing space.
    but when I put in the quote, it is not an exact string match, so it could not find the record. sometimes this flexibility gets me into trouble :\

  • Use variables in a SELECT INTO FROM command

    Hi,
    How do I use variables within a select into from command? I want to loop through SYS.DBA_TABLES using a cursor and count the number of rows in a
    selection of tables an then insert into a cardinality table.
    The count of rows will be stored in a variable called CNT, that bit is easy however I need a variable in the FROM clause because that
    value changes with every iteration of the cursor.
    e.g.
    CNT := 0;
    TN := "MyTable";
    select count(*) into CNT FROM TN;
    insert into cardinality (table_name, row_count) values (TN, CNT);
    This is Oracle 9i and I need the row counts in a separate table as they are shipped over to a different environment for analysis purposes.
    Any ideas?
    Regards
    Dave
    Edited by: Yorky001 on Sep 15, 2010 10:32 AM

    Hi,
    Thanks for the info, unfortunately I can get neither example to work on this 9i system, could well be pilot error as I only ever get
    to do any Oracle about once per year. In the first query I have tried both "user_tables" and SYS.DBA_TABLES, same result.
    set serveroutput on size 1000000;
    DECLARE
    row_count INTEGER;
    vstr VARCHAR2(500);
    vstr1 VARCHAR2(500);
    BEGIN
    vstr := 'SELECT count(*) FROM ';
    dbms_output.put_line(vstr);
    FOR i IN (SELECT table_name FROM user_tables WHERE rownum < 10) LOOP
    vstr1 := vstr || i.table_name;
    EXECUTE IMMEDIATE vstr1
    INTO row_count;
    dbms_output.put_line(i.table_name || ':' || row_count);
    END LOOP;
    END;
    This one complains about the execute immediate line.
    Error report:
    ORA-00933: SQL command not properly ended
    ORA-06512: at line 12
    00933. 00000 - "SQL command not properly ended"
    *Cause:   
    *Action:
    BEGIN
    FOR i IN (select
    table_name,
    to_number(
    extractvalue(
    xmltype(
    dbms_xmlgen.getxml('select count(*) c from '||table_name))
    ,'/ROWSET/ROW/C')) count
    from user_tables
    where rownum<6) LOOP
    dbms_output.put_line(i.table_name || ':' || i.count);
    END LOOP;
    END;
    ORA-19206: Invalid value for query or REF CURSOR parameter
    ORA-06512: at "SYS.DBMS_XMLGEN", line 121
    ORA-06512: at line 1
    ORA-06512: at line 2
    19206. 00000 - "Invalid value for query or REF CURSOR parameter"
    *Cause:    The queryString argument passed to DBMS_XMLGEN.newContext was not a valid query, or REF CURSOR.
    *Action:   Rewrite the query so that the queryString argument is a valid query or REF CURSOR.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Select-options and Parameters, when to use what?

    Hi gurus,
    I have been using Parameters for long. Now I want to choose a range of values, which I need to retrieve from database.
    I tried using select-options. Can't I use 2 parameters that is parameter1 and parameter2 and mention query BETWEEN para1 AND
    para2, and when I use NO INTERVALS and NO EXTENSION together, it behaves same like parameter, then why did SAP gave these
    extensions.

    Hi friend,
    Simple differences between Select-options and parameters.
    Select-Options Uses keyword 'for'                         
    Parameters Uses keywords 'like', 'type'     
    Select-Options  Uses operator 'in'                         
    Parameters Uses operator '='
    Select-Options  Provides ranges for selection     
    Parameters  No ranges only single value
    Select-Options Creates selection table                              
    Parameters No selection table
    Select-Options  When i/p blank all records selected          
    Parameters   When i/p blank none is selected
    Note:
    Select options can act as parameters by using 'no-extension' 'no intervals', but all records will be selected when i/p is blank unlike parameters.
    Might be helpful..
    Thanks...
    Edited by: Guest77 on Feb 10, 2009 5:44 AM

  • How to modify a Procedure "select into" statement to use a cursor

    The below code fails with exception too many rows. How do I modify the Procedure's Select Into statement to use a cursor?
    CREATE OR REPLACE PROCEDURE Track_Asset(
       business_date IN NUMBER DEFAULT NULL,
       missing_table_name  OUT VARCHAR2)
    IS
       ln_business_date NUMBER;
        incorrectdateformat EXCEPTION;
    BEGIN
       IF business_date < 0
       THEN
          RAISE incorrectdateformat;
       ELSE
          DECLARE
            ln_business_date NUMBER;
          BEGIN
             SELECT MAX(business_date)
             INTO ln_business_date
             FROM sproof ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN
             dbms_output.put_line('NO MATCH FOUND');
            WHEN OTHERS THEN
            dbms_output.put_line('ORACLE ERROR :' || SQLERRM);       
          END;
          DECLARE
            missedfeedfnd EXCEPTION;
          BEGIN
             SELECT 'Missing Value : ' || table_name
             INTO missing_table_name
             FROM (
                SELECT UPPER(table_name) table_name
                FROM filespec
                WHERE data_table_name IN ('TABLE1','TABLE2','TABLE3')
                MINUS (
                SELECT DISTINCT UPPER(first_table_name)
                FROM dpca
                WHERE business_date = ln_business_date
                AND first_table_name IN ('TABLE1','TABLE2','TABLE3')
                GROUP BY UPPER(first_table_name) UNION
                SELECT UPPER(first_table_name)
                FROM dpca
                WHERE business_dt_num = TO_NUMBER( SUBSTR('201111', 1, 6) || '01' )
                AND first_table_name = 'TABLE4'
                GROUP BY UPPER(first_table_name) ));
                IF missing_table_name  IS NOT NULL THEN
                   dbms_output.put_line('Missing Value : '|| missing_table_name);
                   RAISE missedfeedfnd;
                ELSE
                  NULL;
                END IF;
          EXCEPTION
             WHEN TOO_MANY_ROWS THEN
       DBMS_OUTPUT.PUT_LINE (' SELECT INTO statement retrieved multiple rows');
              WHEN missedfeedfnd THEN
              raise_application_error ( - 20003, 'Missed Feed');
          END;
        END IF;
          EXCEPTION
       WHEN incorrectdatevalue
       THEN
          raise_application_error ( - 20001, 'Incorrect/Bad Date Entered');
    END;

    ok try this - OUT param will be populated with comma separated list of table names:
    PROCEDURE Track_Asset(
       business_date IN NUMBER DEFAULT NULL,
       missing_table_name  OUT VARCHAR2)
    cursor c_table_names is
    select datatablename
    from   ( select upper(datatablename) datatablename
             from   filespec
             where  data_table_name in ('TABLE1','TABLE2','TABLE3'                                 )
            MINUS
            ( select upper(first_table_name)
              from   dpca
              where  business_dt_num = [-- this date is retrieved by getting the MAX(business_date) from sproof table]
                     and fus_data_table_name in ('TABLE1','TABLE2','TABLE3'
              group  by
                     upper(first_table_name)
             UNION
              select upper(first_table_name)
              from   dpca
              where  business_dt_num = to_number( substr('201111',1,6) || '01' )
                     and first_table_name = 'TABLE4'
              group  by
                     upper(first_table_name)
    begin
       for rec in c_table_names
       loop
           missing_table_name  := missing_table_name  || rec.datatablename ||',';
       end loop;
       missing_table_name  := rtim(missing_table_name , ',');
    end ;HTH
    Edited by: user130038 on Dec 28, 2011 8:46 AM

  • Using SELECT INTO statement to transfer data from one DB to another?

    Hello,
    I need to move data from an SAP table to another downstream SQL server box without flat file in between. I have set up the DBCON interface, so that my ABAP code on SAP can connect to the remote SQL Server, then I can run INSERT command as Native SQL inside the ABAP.
    However, INSERT has performance problem. The best performer as I can find is SELECT INTO statement. But then I am stuck at how to use SELECT INTO to query my local SAP table and send (via INTO) to remote database. I am not even sure whether I should use Open SQL or Native SQL.
    Any suggestion? BTW, I understand the limitation of Native SQL, but we are OK to use it.
    Thanks!

    It appears that this is some kind of migration project due to the scope of the data contained in the single file? If so whatever you do is like ly to be trow away once the migration of data is completed.
    You have a couple of options:
    1) Get the data extracted from HFM in multiple files instead of one bulk file, broken down by scanario,year & period
    2) Take the single data dump file produced by FDM and manipulate it yourself to get the data in a more usuable format for processing through FDM.
    Option 2 could be achieved via any ETL tool or a custom file parsing script. What may be more attractive to you and allow you to fully leverage your investment in FDM is that you could use the PULL adapter that ships as part of the FDM adapter suite to perform this transformation exercise. The PULL adapter takes a flat file input and allows you to use all the in built functionality of FDM to transform it and output a modified flat file (or series of flat files). You could use it to produce multioload files or a series of files broken down by scenario,year,period.
    Whatever you do I would suggest that break the single data file down into smaller chunks as this will help with the iterative debugging process you will inevitably have to undetake whislt migrating the data to the new application.

  • "select into" query statements using the DI API

    I am trying to use the DI API (6.5) t create a temp table based on an existing table.  For example, here is a query string....
    select * into ORDR_TEMP from ORDR
    Code...
    oRecordSet := IRecordset(oCompany.GetBusinessObject(BoRecordset));
    oRecordset.DoQuery(sSql);
    Error I get...
    1). [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot use SELECT INTO in browse mode. 2). [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared
    For any other regular select statements the previous code works.  Does anyone know for sure if a "select into" statement is not possible using the DI API?

    Hi Bill,
    I´m not really sure if select into is avaiable. But here you´ve got a hint: You could use a user defined function to do it, and just call the function from your code.
    SELECT dbo.MyFunction()
    Having this function defined in your SQL Server:
    CREATE function MyFunction ()
    returns char(2)
    AS
    Begin
    select * into ORDR_TEMP from ORDR
    Return ('OK')
    End
    Hope this helps,
    Ibai Peñ

  • Adding Standard Text to the Selection Screen obtained using PARAMETERS

    Hi all,
    I have a report program which has the selection screen declared by the key word PARAMETERS.
    Now I need to make the changes to this program such that a Text Editor appears on the Selection Screen and has a Standard text that should be displayed.
    How can I do it?
    I saw the screen number of the Selection Screen and went to screen painter and tried to add the Text Editot..but it did not let me dou2026.Why?
    How should I add a standard text to a selection screen? The standard text should not be on top , but some where on the screen.
    Regards,
    Jessica Sam

    Hi Sam,
    I dont want to create a new screen for this. On the existing screen whihc was built using PARAMETERS key word..i should insert a blokc of text whihc is mpre than 5-6 lines..how should i do it.
    I navigated to Text Elements---->Selection Texts
    it is now asking for Name and Text and i see in Name column the name of the parametsr that they used for Check box, radio button etc and in Text i see the text that is appearing on the screen
    Now i am not sure what is should do next
    My req is..i should display a block of standard text that doesnt change and whihc is of 4-6 lines?
    how should i do it?
    please also help me with what data declartions that i should do in parametrs key word in program?
    Regards,
    Jessica Sam

  • Still on the inclusion of the time/date field into the spreadsheet file, with 2 real values?

    I have tried to convert the 2 real values to decimal strings, and then taken these 2 values, as well as the date/time strings, put it into an array, converted the array to decimal number, and plugged it into the 1D input of the spreadsheet vi. However, for the date and time, i get the first part only, in a decimal.i.e,for 12:30pm-->12.0000 and for 23/04/2001-->23.0000.
    How can i get the right values, show me an example if u can.
    Thanks.

    1- Open write to spreadsheet file vi.
    2- Save a copy as "Write string array to spreadsheet.vi" or something.
    3- Open this copy.
    4- Replace the numerical controls in the 1D and 2D arrays with string controls.
    5- Save this vi
    6- Now you can wire a string array to this vi and have a spreadsheet from there.
    Remember to modify the COPY, and be careful with the format string.

  • Using select * into within a function

    What I'm wanting to do is to have a select query with many select fields and automatically create a new table (with the same schema) and insert the select result set in this new table.
    I can't seem to figure it out and doing the EXECUTE 'select * into dest_table from orig_table'; wouldn't work (not implemented yet).
    One reason I would like to do it this way is because the field attributes of orig_table may be different from one client to another.
    Thanks for any advice.

    Thanks very much.
    When I tried the execute immediate '...'; in the function I got an error stating: 'type "immediate" does not exist
    I tried to do some research on 'execute immediate' to see what might be the problem but couldn't find anything substantial to my cause.
    I just installed postgreSQL 8.2 this afternoon, and took all the installation defaults, so it may be something I need to configure.
    Anways, however, I just took the actual sql from the execute immediate call and that worked for me.
    Are there any pitfalls to doing it that way.
    Again, thanks for your quick and helpful reply.

  • How to use a parameter field value as a substring in a "like" statement?

    Hi all,
    I'm trying to use a parameter field in a Record selection formula where the parameter field value would be a substring of the data stored in the field.
    My parameter field (SlctResearcher) is constructed as follows:
    Type: string
    List of Values: static
    Value Field: (Reports) RptAuthors
    (in Value Options) Allow custom values?: True
    {Reports.PubDate} in DateTime (2009, 04, 01, 00, 00, 00) to DateTime (2010, 03, 31, 23, 59, 59) and
    {Reports.RptAuthors} like "*{?SlctResearcher}*"
    When I hit F5 to generate the data, I get no results (and the parameter prompt field does not even come up...)
    If I modify the formula to put a hard-coded string, like
    "*Jones*"
    after the 'like', I get results (all the reports where "Jones" is a substring in the RptAuthors string.) If I modify the formula to just use the parameter field without the quotes/stars like:
    {Reports.PubDate} in DateTime (2009, 04, 01, 00, 00, 00) to DateTime (2010, 03, 31, 23, 59, 59) and
    {Reports.RptAuthors} like {?SlctResearcher}
    I do get the parameter prompt field, but still no results even if I put in a valid substring value (since it is not searching for a substring anymore...)
    How can I do this?
    Thanks,
    Will

    1st thing... Make a copy of your report before doing anything!!!
    To use a SQL Command, you'll want to open the Database Expert and look at the Current Connections. Expand the data source and the 1st option you see is the Add Command option.
    To find the SQL That CR is currently using, choose Database from the menu bar and select Show SQL Query...
    You can copy this and paste it directly into the command window. (If you you can write your own SQL you don't need copy CR's, it's just an option.)
    You'll also want to take not of any parameters that you have, you'll need to add them the the Parameter List of the command as well... be sure to spell them EXACTLY as they are in the design pane.
    Anyway, once the SQL statement is in the Command window you'll be able to alter the WHERE clause to use the wild cards.
    For future reference... What type of database are you reporting against???
    Jason

  • Checking Previously Selected Checkboxes using apex_item.checkbox API

    Hello everyone,
    Before I get into the exact nature of my 'problem at hand', I feel it would be a good idea to give you readers a little background info regarding what I'm working on.
    I'm designing a page in my application (a Targeted Email Communications System) entitled the "Impacted Services Selection Screen." In a nutshell, this page will offer multiple check boxes that allow them to select/deselect the applications they wish to be notified about. Additionally, for each service, the user has the option to select the option to receive "planned" outage notifications, "unplanned" outage notifications, or both.
    I'm working with a report region where I'm querying a table called "TEC_APPS" to populate my checkboxes. This table holds three columns which are:
    (1) Primary Key APP_ID: Numerical identifier for each selectable service.
    (2) APP_NAME: Name of the application itself (i.e. Banner INB, Oracle Collaboration Suite, etc.)
    (3) ENTRY_TYPE: Type of entry within the table. I have four categories: (1) Planned Outage Notification, (2) Unplanned Outage Notification, (3) Horizontal Rule Formatting, (4) Title
    The reason for the "ENTRY_TYPE" column is primarily to format the report so it doesn't look like a "table with a bunch of check boxes inside of it".
    Here's the sql query for my report region:
    select APP_NAME,ENTRY_TYPE,APP_ID,
    decode(ENTRY_TYPE,
         'Planned Outage Notification',apex_item.checkbox(1,APP_ID) || ENTRY_TYPE,
         'Unplanned Outage Notification',apex_item.checkbox(1,APP_ID) || ENTRY_TYPE,
         'Title',APP_NAME,
         'Horizontal Rule Formatting','<hr size="6" width = "100%" color="#898A8A">')as result
    from TEC_APPS
    order by APP_ID;basically, this query generates check boxes for ENTRY_TYPEs of Planned/Unplanned Outage notification, Formatted Title Headers for an ENTRY_TYPE of a title, and an html Horizontal Rule for ENTRY_TYPES of horizontal rule formatting (the reason being my boss's specifications required there to be a formatted line that separates each check box group by context). That way, the groups will look like (note '[]' are meant to represent the check boxes):
    BANNER INB
    [ ] Planned Outage Notification
    [ ] Unplanned Outage Notification
    PORTAL
    [ ] Planned Outage Notification
    [ ] Unplanned Outage Notification
    etc....
    Additionally, I have an after submit process which uses the apex global array to store the selected check boxes and perform an insert into a different table called "TEC_SERVICES", which has the columns:
    (1) PRIMARY_KEY SERVICE_ID: Numerical Identifier for each specific service requested for notification.
    (2) SUB_ID ("subscriber id"): Numerical Identifier for each person using this application
    (3) APP_ID: Foreign key reference to "TEC_APPS" which holds information regarding which application the user has selected for each SERVICE_ID
    Here's the code for the process:
    DECLARE
       l_arrayMark  NUMBER;
       CURSOR c_id_check (aMark IN NUMBER) IS
       SELECT service_id,sub_id,app_id
       FROM tec_services
       WHERE sub_id = :p4_sub_id
       AND app_id = aMark;
       r_id_check c_id_check%ROWTYPE;
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
       BEGIN
          l_arrayMark := to_number(APEX_APPLICATION.G_F01(i));
        OPEN c_id_check(l_arrayMark);
        LOOP
          FETCH c_id_check into r_id_check;
          IF c_id_check%NOTFOUND THEN
            insert into "TEC_SERVICES"
            ( "SERVICE_ID",
              "SUB_ID",
              "APP_ID"    )
            values
            ( TEC_SERVICES_SEQ.nextval,
              :P4_SUB_ID,
              to_number(APEX_APPLICATION.G_F01(i)));
            EXIT;
          ELSIF c_id_check%found THEN
            EXIT;
          END IF;
        END LOOP;
        CLOSE c_id_check;
        EXCEPTION
        WHEN DUP_VAL_ON_INDEX
        THEN NULL;
        END;
    END LOOP;
    END;The sub-block loop basically checks to see if the user already has a record for that APP_ID, and if so exits the loop. I threw the unique key EXCEPTION in at the end just to be safe. I'm new to sql and pl/sql so I'm still trying to learn this stuff. I have come pretty far since I first started about 5 weeks ago.
    Anyways, here's my problem:
    I need to create a process that queries my TEC_SERVICES table to see if the person using my application already has a subscription for the "APP_ID" each checkbox in my report represents. If they do, the page is supposed to load with that/those checkbox(s) already checked. My problem is I'm not quite sure how to update those checkbox values. I have created a "before header" process that aimed at doing this, but is not working. Here is the "rough draft" of the code:
    DECLARE
       l_arrayMark NUMBER;
       CURSOR c_id_find (aMark IN NUMBER)IS
       SELECT sub_id, app_id
       FROM tec_services
       WHERE sub_id = :p4_sub_id
       AND app_id = aMark;
       r_id_find c_id_find%rowtype;
    BEGIN
    if APEX_APPLICATION.G_F01.count = 0 THEN return;
    end if;
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
        BEGIN
        l_arrayMark := to_number(APEX_APPLICATION.G_F01(i));
        OPEN c_id_find(l_arrayMark);
        LOOP
        FETCH c_id_find INTO r_id_find;
        IF c_id_find%found THEN
        apex_util.set_session_state(apex_item.G_F01,'CHECKED');
        -- ** This is where I'm getting mixed up...this is basically trying to say, "if the record for this checkbox already exists for this person, then show this checkbox as selected."
        -- ** I just don't know how I am supposed to do that.  Maybe something similar, but more along the lines of: UPDATE apex_application.g_f01(p_checked_values => 'CHECKED')
        ELSIF c_id_find%notfound THEN
        exit;
        END IF;
        END LOOP;
        CLOSE c_id_find;
        END;
    END LOOP;
    END;I guess I just really don't know how to do this, and it's "Grinding my gears."
    Any help is much appreciated.
    Thank you all,
    Eric
    *** NOTE *** This is my first post ever in the oracle forums. I noticed that even when I include spaces and indentation in my code/post text, it doesn't display in the actual thread itself. Anyone know the markup to insert such things...or like an &nbsp?
    Edited by: user11685190 on Sep 28, 2009 2:09 PM
    Edited by: user11685190 on Sep 29, 2009 6:32 AM

    Gus,
    1. Yeah...I tend to get carried away sometimes. This one's been killing me though b/c I've got a deadline of four weeks left to do this thing and I still have three somewhat "beastly" pages to write before it's completely ready to be tested and considered for production. On top of that, I'm pretty much learning a lot of this stuff as I go.
    2. The first two loops I showed you (Query for the checkbox report, On-Submit process to read checkboxes and insert table data) are fully functional. The problem is, I've worked with "checkbox items" but not so much with the apex API for Report Checkboxes "apex_item.checkbox(p_id, p_val, etc.)). I don't know "how" I could write a pl sql process that queries the table when the page loads to check the checkboxes....addionally, I don't know what commands to use to fill these boxes b/c I've found somewhat unrelated information by conducting web research. Code-wise, my problem is I don't know whether to use:
    UPDATE apex_application.g_f01(p_checked_values => 'CHECKED') ** OR ** if you'd instead use something like 'set available flag = 'Y'' The real problem is I just don't know how I'd do it.
    ...but, on second hand, I do find light in what you said about the "before header" process. If you look at the plsql block, the cursor I'm using to "see if that person already has subscribed to the service
    represented by a checkbox," I'm referencing the page item :P4_SUB_ID. Since this is a before header process...it is running (i think) before the :p4_sub_id item loads...so the cursor is most likely returning as 'not found,' therefore it
    does nothing. However, the source for the :P4_SUB_ID item says to use the source only when the value in session state is null. Because of this, I don't know if my above thoughts are correct.
    Thank you for your thoughts and posting that link...I'll look into it a bit further.
    Oh yeah...and thanks for the [/*code] tip...that looks a ton better.
    Eric                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • How do I create a PDF form for submission that can be used by Acrobat Reader only users?

    I am attempting to create a PDF document in Acrobat Pro with fields that can be submitted (via email) by users using only Acrobat Reader. I have tried changing the properties of the 'Submit' button, although I am not sure what I am doing wrong. Can a

  • Not Visible in iTunes and YouTube doesn't Connect in 2.3

    I was happily working away with ATV until upgrade 2.3 and iTunes 8 came out. Since then, I have reverted back to factory reset several times and find that this is the only reliable setup, I'd love to have my MobileMe gallery and YouTube working again

  • Adobe photoshop cs6 à cessé de fonctionner help

    Bonjour , Je rencontre un soucis avec mon photoshop CS6 Dés que je valide une modification sur une image ( ctrl +t ) il ce fige et me marque photoshop a cessé de fonctionner . Celui ci est installé sur une machine neuve , a jour , je viens aussi de r

  • Speech bubbles in Muse

    Hi, I'm designing my site in Muse. A main feature will be interviews. I'll be designing a jpeg background, with name of interviewee seperately designed at the top - do I need to merge these as 1 in PS or can I layer in Muse? But my main question, is

  • JFileChooser not returning files with their extensions intact?

    I have now come across a very annoying problem: when I use a JFileChooser on Mac OS X, any files whose extensions are hidden are returned without the extension at all. For example, using a JFileChooser and selecting a TIFF image at /Users/me/image.ti