Query only recognized inside an If Statement?

I have the following code in my JSP page:
If I place these line inside the if statement it works but
ie:
boolean temp = Get_field_data_1_rs.last();
If it is outside the if statement I get the following error:
ie:
boolean temp = Get_field_data_1_rs.last();
C:\\Program Files\\Allaire\\JRun\\servers\\default\\demo-app\\query1.jsp:20: Error: "Get_field_data_1_rs" is either a misplaced package name or a non-existent entity.
Any Ideas whats going on?
Code sample:
<% TableCount=1;
if (TableCount == 1) {
          String var_rest= "";
          if (Table_Array[TableCount][7].compareTo("") != 0) {
               var_rest = " WHERE " + Table_Array[TableCount][7];
          } else {
               var_rest= "";
     Statement Get_field_data_1 = report_data_connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
     ResultSet Get_field_data_1_rs = Get_field_data_1.executeQuery("     SELECT " +
                                                                                     Table_Array[TableCount][4] +
                                                                                     " FROM " + Table_Array[TableCount][1] +
                                                                                     var_rest + " ORDER BY " +
                                                                                     Table_Array[TableCount][6]);
boolean temp = Get_field_data_1_rs.last();
int max_rows = ( Get_field_data_1_rs.getRow());
Get_field_data_1_rs.beforeFirst();
%>

// because statement was declared inside if,
// put it before if statement
Statement Get_field_data_1 = null;
if ( condition ..)
{  Get_field_data_1 = ....    }
else

Similar Messages

  • Decode Statement Inside the Case statement

    Can we use Decode Statement inside a CASE Statement as show below --
    It is giving an error -- Is the a better way to write with out any error
    create or replace
    function test (a varchar2) RETURN VARCHAR2
    is
    m varchar2(20);
    begin
    m :=
    CASE
    WHEN a IN (
    '1009' -- (soon obsolete)
    ,'1010'
    ,'1019'
    ,'1051'
    ,'XGP'
    ,'XSC')
    THEN (SELECT DECODE(v_lef_cd,'NAM','71','GLB','99','01') into m FROM DUAL)
    -- ) THEN '01' -- UNITED STATES OF AMERICA
    WHEN a IN (
    '1069' -- South Africa
    ,'SAO' -- South Africa
    ,'SA' -- South Africa
    ) THEN '26' -- South Africa
    ELSE NULL
    END;
    return m;
    end;

    Hi,
    You can only use DECODE in SQL statements.
    Your SELECT DECODE (...) INTO statement would work anywhere a PL/SQL statement is allowed; but PL/SQL statements are not allowed within CASE expressions.
    Remember, the expression that comes after THEN in a CASE expression must be a single value.
    I would write a function like this using IF ... ELSIF statements. It's a little more typing than CASE, but a lot easier to code, test and maintain.
    If you want to use CASE, here's one way:
    ...     m := CASE
              WHEN  a  IN ('1069', 'SAO', 'SA')
                   THEN  '26'     -- South Africa
              WHEN  a  NOT IN ('1009', '1019', '1051', 'XGP', 'XSC')
              OR    a  IS NULL
                   THEN  NULL
              WHEN  v_lef_cd = 'NAM'
                   THEN  '71'
              WHEN  v_lef_cd = 'GLB'
                   THEN  '99'
                   ELSE  '01'     -- USA
              END;This assumes that you have a variable v_lef_cd defined.
    If you want, you can nest CASE expressions, like this:
    ...     m := CASE
              WHEN  a  IN ('1069', 'SAO', 'SA')
                   THEN  '26'     -- South Africa
              WHEN  a  IN ('1009', '1019', '1051', 'XGP', 'XSC')
                   THEN  CASE  v_lef_cd
                          WHEN  'NAM'
                             THEN  '71'
                          WHEN  'GLB'
                             THEN  '99'
                             ELSE  '01'     -- USA
                         END
              END;Always format your code, so you can see where the CASE expressions and each of the WHEN clauses begin and end.
    When posting formatted text on this site, type these 6 characters:
    (all small letters, inside curly brackets) before and after sections of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Why DECODE can only be used in sql statement

    Hi,
    Why the sql1 works but sql2 doesn't.
    sql 1 ) Select decode(1,0,0,1) into var from dual;
    sql 2 ) var = decode(1,0,0,1);
    Kindly clarify.
    Regards,
    Kishore

    Hi Purvesh,
    2nd works fine for 11g onwards.
    Really?
    Got the same error when executed the below (on Oracle 11.2.0.3.0)
    SQL> DECLARE
      2    var_x NUMBER := 1;
      3    var_y VARCHAR2(10);
      4  BEGIN
      5    var_y := Decode(var_x, 1, 'Yes', 'No');
      6    Dbms_Output.PUT_LINE('var_x: '||var_x);
      7    Dbms_Output.PUT_LINE('var_y: '||var_y);
      8  END;
      9  /
      var_y := Decode(var_x, 1, 'Yes', 'No');
    ERROR at line 5:
    ORA-06550: line 5, column 12:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL
    statement only
    ORA-06550: line 5, column 3:
    PL/SQL: Statement ignored
    Please explain me the same.

  • Lightroom only recognizing / importing ~10% of the images on my memory card, but not consistently?

    Lightroom is only recognizing some images from my memory card when I import from the camera. The amount of images it recognizes on a given attempt varies (114 one time I plugged in and tried to import, 128 images another time...etc.). It's only seeing about 10% of total number of images on the card, AND the previews of the images it does see aren't working.
    Any ideas? This started right after I downloaded the recent updates.
    Previously I've had problems with it being slow to recognize the camera when plugged in, but this is a new one. I know the photos are still there (thank goodness) because I can flip through them on my camera.
    Thanks!
    Katie
    Stats:
    I'm on a MacBook Pro, OS X 10.9.4.
    Lightroom 5, Version 5.6 (Build 974614)
    Just downloaded the updates today.
    Camera is a Nikon D90, a few years old.
    Memory card is a SanDisk 16GB SDHC.
    Things I've already tried (that haven't worked):
    Restarting Lightroom
    Creating a new catalogue, and importing to that
    Optimizing the existing catalogue
    Turning the camera on and off
    Trying a new connector cables (USB to mini USB)

    Hi Katie,
    When you put the SDCard directly into the MacBook's memory card reader and import from there, do the pictures you expect show up in the previews?
    Maybe it's the camera's USB port that is slowly giving up..
    Greetings,
    Simon

  • Query-only privilege

    i want to know what are query-only privileges.for example i want to grant query-only privileges to user XYZ on object emp.
    can any one provide me an example for granting query-only privileges for the above scenerio.
    thankx.....

    Hi,
    As Eric said, you can grant object privileges on the tables to the role instead of directly to the user, but remember that if the user do tables calls to the other user through PROCEDURES or FUNCTIONS, you need grant the object privilege directly to the user like a example below:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SYSTEM@ORACLE10> create role readonly;
    Role created.
    SYSTEM@ORACLE10> grant select on test2.emp to readonly;
    Grant succeeded.
    SYSTEM@ORACLE10> create user test identified by test default tablespace USERS quota unlimited on USERS;
    User created.
    SYSTEM@ORACLE10> grant connect,resource to test;
    Grant succeeded.
    SYSTEM@ORACLE10> grant readonly to test;
    Grant succeeded.
    SYSTEM@ORACLE10> connect test/test
    Connected.
    TEST@ORACLE10> select count(*) from test2.emp;
      COUNT(*)
             10
    TEST@ORACLE10> create or replace function EXAMPLE return NUMBER as
      2  BEGIN
      3    declare
      4       result number;
      5    BEGIN
      6    select count(*) into result from test2.emp;
      7    return result;
      8    END;
      9  END;
    10  /
    Warning: Function created with compilation errors.
    TEST@ORACLE10> show errors
    Errors for FUNCTION EXAMPLE:
    LINE/COL ERROR
    6/3 PL/SQL: SQL Statement ignored
    6/41 PL/SQL: ORA-01031: insufficient privileges
    TEST@ORACLE10> connect test2/test2
    Connected.
    TEST2@ORACLE10> grant select on emp to test;
    Grant succeeded.
    TEST2@ORACLE10> connect test/test
    Connected.
    TEST@ORACLE10> create or replace function EXAMPLE return NUMBER as
      2  BEGIN
      3    declare
      4       result number;
      5    BEGIN
      6    select count(*) into result from test2.emp;
      7    return result;
      8    END;
      9  END;
    10  /
    Function created.
    TEST@ORACLE10> select example from dual;
       EXAMPLE
             10Cheers

  • Update a single column in query only form

    Forms 9i, database 10g
    I am migrating the form from 6i to 9i. I have a form that is query only except for one field that can be updated. The main block1, based on a view, includes most of the person's personal data, none of which is updateable.. Another block2, based on a table, includes the 3 not-null colums that cannot be updated, and a remarks field, which can be updated. The block2 properties are set YES for insert, update, delete. The three non-updatable columns have properties set to NO for I,U and D, but the remarks column has I,U and D properties set to YES. When I enter data into the remarks field and press the Save on the Forms icon bar, I get error FRM-40508:unable to insert record and the ORA-00001:unique constraint. I don't should not be able insert and I don't want to, I just want to update one column.
    What am I not setting correctly in 9i? The same triggers and code works in 6i.
    Any suggestions are greatly appreciated.
    Vija

    No, there are no on-update triggers, but there are Post-Qry. I did run it in debug mode, but there is no good place to put a break point, since retrieval of the data works fine. Should I have key-commit trigger on the block to do the update?
    Vija

  • Data entry form problem - form in query-only mode

    Hi there,
    I am trying to create an data entry form to insert recordacross 2 out of 3 tables. The last of the four tables already have details and does not need to have record inserted into.
    This is the scenario, my four tables are Factory, Employee, Works_in. Works_in resolves a many to many relationship between Factory and Employee
    Now for a person to be employed in a factory, he must be assigned to a factory.
    I have a list of factories already in the database. After choosing a factory from the database, I want to insert records to do with his Fname, Lname, Hiredate bla, bla, bla to the Employee table.
    I have a single form with Factory as the master, and 2 tabs each for Employee and Works_in.
    After linking all my tables with the ability to choose a factory first on the master form from a combo box and after inserting records into the other forms, it says form running in query-only mode.
    What do you think?
    Many thanks in advance.
    Cube60

    I think that's too much of the wrong information.
    It sounds like you have multiple forms. Are they Modal or Non-Modal?
    What code do you use to call the form that's not working?
    Does it work initially and then stop working?
    James.

  • Enabling item on a query-only form

    Hi,
    I call a custom 6i form in query-only mode. However, now I need to enable one item on the first window for search purposes. I tried using SET_ITEM_PROPERTY,(ITEM_NAME,'Insert Allowed','TRUE') but it doesn't work. How do I achieve that functionality?
    Thanks.

    Hi,
    Thanks for the reply. I tried to set the property 'enabled' of the item to true so that I might be able to enter or update data into it.
    I am trying to change the form status from query only = YES and disable the blocks associated with it.

  • Purchase Order form in Query only mode for some users

    Hi All,
    I want to make the Purchase Orders form as query only for a single user. I tried by giving 'Query_only=Yes' in the parameters section. I am getting 'FRM-04151: You cannot query records here' message more than 10 time. I know we get this message and this is applicable to all the users. But this message is comming more than 10 times.
    Is there anyway that I can restrict the Query only mode to a single user and please suggest about the message also.
    Thanks in Advance,
    Naresh

    Naresh,
    Since you want to achieve this for one user only, I would suggest you create a new function/menu/responsibility and assign this responsibility to the user.
    Note: 400380.1 - How To Create a QUERY-ONLY FORM
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=400380.1
    For the FRM error, please review the following document.
    Note: 116074.1 - ACCESS LEVEL - REVIEW ONLY - PO
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=116074.1
    Regards,
    Hussein

  • Called form in query only mode shows messages....

    Hi All,
    I am calling a form (say B ) in query only mode from a main form (say A) . When i query the called form B , i get 5-6 alerts (which has to be acknowledged by the user) and messages of the same error type saying :
    "FRM-40208 : Form running in query only mode . Cannot change database fields. "
    I have a 100 forms to be called from the main form A. So, I prefer not to change anything in the called forms . I tried to set message_level in the form A and code the on-error / on-message triggers to avoid the messages being shown, but nothing is working . Is there anything I can do in Form A i.e the main form ???
    Thanking you in advance.

    Since the error messages are being generated by form B, it is unlikely you will be able to fix form B problem using form A. Unfortunately, you may have to fix each of the 100 called forms.

  • How to know that a form is running in query-only mode

    I have a form that can run in query-only mode or non-query-only mode depending on the current user who logs in, and I want to change its apprearance dynamically when it's in different modes (for example, enable or disable buttons). Is there a built-in or system variable from which I know that the form is running in query-only mode or not?
    Thanks,
    Shu

    The global variable solution is what we are using now. I thought there are some unpublished built-in or system variables. In my application, there is a public "menu" form from where hundreds of forms are CALLed with some in query-only mode and some in non-query-only mode depending on the current user role. :PARAMETER.QUERY_ONLY will always be 'NO' because the "menu" form is started in non-query-only mode. But it's good to know about it.
    Thank you very much for your replies,
    Shu

  • Query-Only Form

    How can I restrict a form to be used for Query-Only sometime (for some users) which can also be used as Insert/Update etc another time (for other users).
    I am using Open_Form not Call_Form.

    use
    CALL_FORM('<formname>', no_hide, no_replace,
    query_only);
    Thanks

  • Query only form problems

    I have a data block linked to a parent table in a parent/child relationship. The parent table's query key is made up of 2 data items. When the form is executed I want the users to enter values in these 2 data items and then press a button that has a trigger to execute the query. How can this be done and what properties should be set on the data block and items in this data block? Also, this form is a query only type form, no updating is to be premitted to the database.

    1. Consider to build a control block with these two items in the block.
    2. Create a LOV which will return the two items from a record group to the items in the control block.
    3. Passing the control block items' value for your query.
    Good luck.
    Jimmy

  • Purchase Orders form in Query Only mode for a single user

    Hi All,
    I want to make the Purchase Orders form as query only for a single user. I tried by giving 'Query_only=Yes' in the parameters section. I am getting 'FRM-04151: You cannot query records here' message more than 10 time. I know we get this message and this is applicable to all the users. But this message is comming more than 10 times.
    Is there anyway that I can restrict the Query only mode to a single user and please suggest about the message also.
    Thanks in Advance,
    Naresh

    Please post this question here: OA Framework
    There are so many special conditions and restrictions for E-Biz Suite that this forum is not the right place to ask these questions. The Apps forum at this location is the right place.

  • Update one column in Query only block

    Hi,
    I have a question regarding multi-record, multi-columns form block.
    A block has 100 columns (column1 to column100).
    We have two separate version of same form. In query only mode, update_allowed property of all the blocks in the form is False.
    But in query only form, one specifc column should be updateable.
    How can use Custom.pll to achive this functionality ?
    I tried following steps
    1. In when-new-item instance of column 54, wrote set_item_property and set_block_property
    2. Update allowed for block and specific item is True
    I know that Block property will override the property of items.
    Now all the items are updateable in query only form. But i want only one column updateable.
    Appreciate you valuable input on this.
    Thanks

    This is an eBusiness-related question, you should post it in the eBusiness-forum. From the "pure" forms point of view, set the Block as updateable and set all item except the one you want to be updateable to UPDATE_ALLOWED =PROPERTY_FALSE

Maybe you are looking for