Using a Dynamic cursor

Hi,
I have a problem with this code :
DECLARE
     v_Column_Name           all_tab_columns.column_name%TYPE;      -- variable for TABLE_SQL
     v_data_type           all_tab_columns.data_type%TYPE;      -- variable for CHPS_SQL
     v_Table_Name           user_tables.table_name%type;
     lc$results     VARCHAR2(32767) := null;
     lc$Champ     VARCHAR2(32767) := null;
     lc$Requete     VARCHAR2(32767) := null;
     CURSOR C1 IS
          SELECT table_name FROM user_tables;
BEGIN
     OPEN C1;
     LOOP
          FETCH C1 INTO V_Table_name;
          EXIT WHEN C1%NOTFOUND;
          DECLARE
               CURSOR C2 IS
                    select column_name, data_type from all_tab_columns where table_name = V_TABLE_NAME;
          BEGIN
               lc$results := 'INSERT INTO ' || v_table_name || '(';
               lc$requete := 'SELECT ' ;
               lc$Champ := NULL;
               OPEN C2;
               LOOP
                    FETCH C2 INTO V_column_name, V_data_type;
                    EXIT WHEN C2%NOTFOUND;
                    if lc$Champ IS NOT NULL then
                         lc$Champ := lc$champ || ',' || v_column_name;
                         lc$requete := lc$requete || ',' || '''''''''' || ',' || v_column_name || ',' || '''''''''';
                    else
                         lc$champ := lc$champ || v_column_name;
                         lc$requete := lc$requete || '''''''''' || ',' || v_column_name || ',' || '''''''''';
                    end if;
               END LOOP;
               CLOSE C2;
               lc$results := lc$results || lc$champ || ') VALUES (';
               lc$requete := lc$requete || ' FROM ' || v_table_name;
-- MY PROBLEM BEGIN HERE
               DECLARE
*                    TYPE EmpCurTyp IS REF CURSOR;*
*                    C3     EmpCurTyp;*
*               BEGIN*
*                    OPEN C3 FOR lc$requete;*
*                    lc$champ := NULL;*
*                    LOOP*
*                         FETCH C3 INTO lc$champ ;*
*                         Exit when C3%NOTFOUND ;*
*                         lc$champ := lc$results || lc$champ || ')';*
*                         dbms_output.put_line(lc$champ);*
*                    END LOOP;*
*                    CLOSE C3;*
*               END;*
          END;
     END LOOP;
     CLOSE C1;
END;          
the error code is : ORA-00932: inconsistent datatypes: expected - got -
Need help please,
Thank

904907 wrote:
How can I use the dbms_SQL for this code?99% of the time this indicates design issues. You are trying to write "one-size-fits-all" code which by definition will have substantial overhead. Other than that, in general, you need to declare a variable for each data type possibly returned by dynamic SQL. Then use DBMS_SQL.DESCRIBE_COLUMNS to get data types of select list expressions. Fetch a row and then loop from 1 to number of select list expressions where loop body is one giant IF to test select list expression datatype and issue corresponding DBMS_SQL.COLUMN_VALUE into proper data type variable.
SY.

Similar Messages

  • How to use a dynamic cursor

    Hi! All, I am trying to create a table at run time and insert values in it and selecting from the created table. my pl/sql does not complie and gives me a error.
    DECLARE
    rc sys_refcursor;
    TYPE t1_row IS RECORD (col1 NUMBER, col2 number(3));
    TYPE t1_tab IS TABLE OF t1_row;
    v_tab t1_tab;
    v_table_name varchar2(10);
    v_col1 number:=1;
    v_col2 number:=111;
    BEGIN
    execute immediate 'create table t1 (id number, name number)';
    execute immediate 'insert into t1(id, name) values(:v_col1, :v_col1)' using v_col1, v_col2;
    OPEN rc FOR 'SELECT id, name FROM t1';
    FETCH rc INTO v_tab;
    FOR i IN 1..1 LOOP
    dbms_output.put_line(v_tab(i).col1||'::'||v_tab(i).col2);
    END LOOP;
    END;
    the above code gives me a error.Could any 1 pease help.
    ERROR at line 13:
    ORA-06550: line 13, column 20:
    PLS-00597: expression 'V_TAB' in the INTO list is of wrong type
    ORA-06550: line 13, column 5:
    PL/SQL: SQL Statement ignored
    Regards,
    Ritesh
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]

    DECLARE
    rc sys_refcursor;
    TYPE t1_row IS RECORD (col1 NUMBER, col2
    col2 number(3));
    TYPE t1_tab IS TABLE OF t1_row;
    v_tab t1_tab;
    BEGIN
    OPEN rc FOR 'SELECT id, name FROM t1';
    FETCH rc INTO v_tab;
    You have to use BULK COLLECT when you use a collection like that:
           FETCH rc BULK COLLECT INTO v_tab;

  • Dynamic Cursor in a procedure

    Hi,
    I am using 10g and wanted to check if we can use a dynamic cursor in a procedure.
    Following is my code and wanted to see if that can work with every query passed as a parameter.
    example ,
    exec test1 ('select col1, col2, col3 from table1','Two columns Sql')
    exec test1 ('select col1 from table2','one columns Sql')
    exec test1 ('select col1, col2, col3, col4, col5 from table3','Five columns Sql')
    CREATE OR REPLACE procedure test1 (p_sql IN VARCHAR2, p_subject IN VARCHAR2
    is
      v_cu_string       VARCHAR2(2000);
      v_string          VARCHAR2(2000);
      v_sql             VARCHAR2(4000);
      v_head            VARCHAR2(4000);
      v_head_sql        VARCHAR2(4000);
      v_str_sql         VARCHAR2(4000);
          TYPE cv_typ IS REF CURSOR;
          cv cv_typ;
    begin
      v_sql := p_sql;
        OPEN cv FOR v_sql;
           LOOP
             FETCH cv INTO v_cu_string;
             EXIT WHEN cv%NOTFOUND;
            ------ Processing steps
          END LOOP;
          CLOSE cv;
    END;Thanks

    user527060 wrote:
    Following is my code and wanted to see if that can work with every query passed as a parameter.
    Just curious as to why this is an improvement of
    exec test1 ('select col1, col2, col3 from table1','Two columns Sql')
    select col1, col2, col3 from table1And
    exec test1 ('select col1 from table2','one columns Sql')
    select col1 from table2And
    exec test1 ('select col1, col2, col3, col4, col5 from table3','Five columns Sql')
    select col1, col2, col3, col4, col5 from table3It needs more code from you to build, more code for anyone to enter to execute, limits selects to only one table I would guess also comes with less documentation than SQL.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm

  • Workaround for opening a strongly typed cursor using native dynamic SQL

    Hi All,
    In reading the PL/SQL documentation for Oracle 9i, I noted that the OPEN-FOR
    statement with a dynamic SQL string only allows the use of weakly typed cursors.
    I have verified this limitation with my own experimentation as follows:
    DECLARE
    type rec_type is record(
    str     varchar2(40),
    num     number(22)
    type cur_type is ref cursor return rec_type;
    my_cur     cur_type;
    que     varchar2(100);
    tab     varchar2(40);
    BEGIN
    tab := 'dynamic_table_name';
    que := 'select key_name, key_value from ' || tab || ' where key_name like ''01%''';
    open my_cur for que;
    loop
    if my_cur%found then
    dbms_output.put_line('source_name: ' || my_cur.str || ', page_sn: ' || my_cur.num);
    exit;
    end if;
    end loop;
    close my_cur;
    END;
    Running the above trivial example in an anonymous sql block yields the following
    errors as expected:
    ORA-06550: line 10, column 8:
    PLS-00455: cursor 'MY_CUR' cannot be used in dynamic SQL OPEN statement
    ORA-06550: line 10, column 3:
    PL/SQL: Statement ignored
    ORA-06550: line 13, column 54:
    PLS-00487: Invalid reference to variable 'MY_CUR'
    ORA-06550: line 13, column 7:
    PL/SQL: Statement ignored
    Is there a workaround to the situation? Since I do not know the table name at run
    time, I must use Native Dynamic SQL. I have a long and complex record type
    that I wish to return through JDBC using the REFCURSOR Oracle type in order to
    avoid having to register an inordinate number of OUT parameters. Moreover, I
    would like to return potentially one or more results in a ResultSet. Using the
    standard method of registering native SQL types for the IN and OUT bindings
    can only return one result. Hence the reason I would like to return a strong
    cursor type. Also, the type of query I am doing is complex, and needs to be
    executed in a PL/SQL procedure for performance reasons. Therefore simply
    executing a SELECT query dynamically built up on the the JDBC client won't
    do the trick.
    If anybody has experience with a similar problem and would like to volunteer
    information on their workaround, I would really appreciate it.
    Best Regards,
    J. Metcalf

    We can use strongly-typed REF CURSORs in DNS, but the typing derives from a table e.g.
    TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
    so the problem is your use of "return rec_type" bit.
    Forgive my bluntness but I think you have misunderstood strong and weak typing. You actually want to be using weakly-typed cursors. I mean this:
    Moreover, I would like to return potentially one or more results in a ResultSet. suggests that the structure of your resultset may vary, which is precisely what a weakly-typed ref cursor allows us to do. Then we can use the JDBC metadata methods to interrogate the structure of the resultset, innit.
    so try this:
    DECLARE
    type cur_type is ref cursor;
    my_cur cur_type;
    que varchar2(100);
    tab varchar2(40);
    BEGIN
    tab := 'dynamic_table_name';
    que := 'select key_name, key_value from ' || tab || ' where key_name like ''01%''';
    open my_cur for que;
    loop
    if my_cur%found then
    dbms_output.put_line('source_name: ' || my_cur.str || ', page_sn: ' || my_cur.num);
    exit;
    end if;
    end loop;
    close my_cur;
    END;
    ras malai, APC
    Cheers, APC

  • PLS-00455: cursor 'CUR_1' cannot be used in dynamic SQL OPEN statement

    create or replace function f_my_test_func
    return refcur_pkg.refcur_t1
    is
    cur_1  refcur_pkg.refcur_t1;
    begin
    open cur_1
    for
    'select * from dept';
    return cur_1;
    exception
    when others
    then
    insert into ddl_log (SQLTEXT)
    values
    ('fucntion error'); 
    end;

    I would suggest that cur_1 refcur_pkg.refcur_t1 is a stongly typed ref cursor i.e. it has RETURN dept%ROWTYPE or something similar in the declaration. You can't use strongly typed ref cursors with dynamic SQL in this way. The declaration should be weakly typed or just use sys_refcursor.
    DTYLER_APP@pssdev2> DECLARE
      2
      3      TYPE t_Strong   IS REF CURSOR RETURN dual%ROWTYPE;
      4
      5      lc_Strong       t_Strong;
      6
      7  BEGIN
      8
      9      OPEN lc_Strong FOR
    10      'SELECT * FROM dual';
    11
    12  END;
    13  /
        OPEN lc_Strong FOR
    ERROR at line 9:
    ORA-06550: line 9, column 10:
    PLS-00455: cursor 'LC_STRONG' cannot be used in dynamic SQL OPEN statement
    ORA-06550: line 9, column 5:
    PL/SQL: Statement ignored
    DTYLER_APP@pssdev2>
    DTYLER_APP@pssdev2> DECLARE
      2
      3      TYPE t_Weak   IS REF CURSOR;
      4
      5      lc_Weak       t_Weak;
      6
      7  BEGIN
      8
      9      OPEN lc_Weak FOR
    10      'SELECT * FROM dual';
    11
    12  END;
    13  /
    PL/SQL procedure successfully completed.
    DTYLER_APP@pssdev2> DECLARE
      2
      3      lc_Weak       sys_refcursor;
      4
      5  BEGIN
      6
      7      OPEN lc_Weak FOR
      8      'SELECT * FROM dual';
      9
    10  END;
    11  /
    PL/SQL procedure successfully completed.
    DTYLER_APP@pssdev2>HTH
    David

  • What are the advantages to using a REF cursor

    When would I want to use a REF cursor?

    REF CURSORs are not cursors, they're references to cursors. This means they're dynamic. So you can completely change the query executed by the cursor.
    For example you can use a REF CURSOR to select from one of a number of tables (depending on an input parameter or other sort of flag). The results are fetched into the same resultset holder and hence you only need a single lot of code to process the results.
    Also you can also pass a REF CURSOR as a argument to other PL/SQL procedures and functions.
    rgds, APC

  • Dynamic cursor definition in PL/SQL

    Is it possible to have dynamic cursor definition in PL/SQL. Like
    using DBMS_SQL for dynamic SQL. If yes, how?

    Assuming I understand your question correctly, you can use a REF
    CURSOR to which you associate a VARCHAR2 which is the query text:
    DECLARE
    TYPE t_cur IS REF CURSOR ; -- define t_cur as a type
    c_cur t_cur ; -- define an actual variable of type t_cur
    r_emp emp%ROWTYPE ; -- PL/SQL record to hold row
    v_query VARCHAR2(2000) := 'SELECT * FROM emp' ; -- the query!
    BEGIN
    OPEN c_cur FOR v_query ; -- v_query could contain any valid query
    FETCH c_cur INTO r_emp ; -- get first row from dataset
    CLOSE c_cur ; -- remember to close the cursor! ;)
    END ;
    HTH

  • Report with Dynamic Cursor

    hi forum
    I need your help and I hope you can help me. In my job I need to do a Report, but the function that containts the cursor returns a ref cursor and this ref cursor doesn't return a special format 'cause the cursor that I use is Dynamic so when I try to do the report it is not generated.
    the documentation says that should return something for example
    type vref_cursor is ref cursor[b] return record;
    or
    type vref_cursor is ref cursor return depto%rowtype;
    but if I use this in a dynamic cursor it generates an Error and don't accpet this declaration only the following
    type vref_cursor is ref cursor;
    Do you Know how should I do the report with a dynamic cursor ?
    best regards
    thank's a lot

    That is not possible. From the online help:
    Each ref cursor query is associated with a PL/SQL function that returns a strongly typed ref cursor.

  • Fetching values of Dynamic Cursor

    Hi,
    Can I fetch values of dynamic cursor into a variable(record OR individual)? If yes what will be the type of that record/variable?
    Thanks in Advance!
    Regards
    RK

    bluefrog wrote:
    There is no way in 10g to identify the column data types of the result set of a dynamic ref cursor.
    In 11g one can use ;
    DBMS_SQL.DESCRIBE_COLUMNS (
    c IN INTEGER,
    col_cnt OUT INTEGER,
    desc_t OUT DESC_TAB);when using DBMS_SQL
    P;In 11g you can use a ref cursor and then use the DBMS_SQL package to convert that ref cursor to a DBMS_SQL cursor where you can then describe the columns. The initial query doesn't have to be a DBMS_SQL cursor. In 10g, unfortunately, there is no way to convert the ref cursor to a DBMS_SQL cursor, so dynamic cursors would have to be written as DBMS_SQL cursors initially. Ref cursors are only really suitable for 3rd party tools, such as when passing queries back to .NET or Java applications. Too many people try and use ref cursors inside PL/SQL and then discover why that's not a good idea.
    PL/SQL 101 : Understanding Ref Cursors:-
    PL/SQL 101 : Understanding Ref Cursors

  • Can I create a dynamic cursor in a program unit on oracle form....

    Hello folks,
    can I create a dynamic cursor on client side ( in a program unit on the oracle form), is it possible, I Know how to create it on server side using Ref cursor, but on client side i got this message (can't be created on client side or something like that).... please if someone can help

    > select count(*) from t_comsis
    <p>But when you put that select string into a varchar2 variable, it won't compile. Which makes it hard to create anything "dynamic".
    <p>In Forms, you can create and populate a record group dynamically, which is ok as long as your select will not retrieve too many (more than several hundred) rows.
    <p>Or, your other option is to use the Forms Exec_SQL dynamic sql package.

  • Dynamic cursors

    Hi,
    I'm trying to work on dynamic cursors.
    When I try to execute the below code, I'm getting the following error.
    BEGIN
      DYNAMIC_CURSOR.OPENCURSOR();
    END;
    exception raised ORA-00932: inconsistent datatypes: expected - got -
      Below is my code:
    CREATE OR REPLACE
    PACKAGE BODY dynamic_cursor AS
        PROCEDURE dyn_sel (
            tab_name   IN VARCHAR2,
            field_name IN VARCHAR2,
            val        IN VARCHAR2,
            crs        IN OUT t_crs)
        IS
            stmt VARCHAR2(200);
        BEGIN
            stmt := 'select * from '|| tab_name || ' where '|| field_name ||  ' = :1';
            OPEN crs FOR stmt USING val;
        END dyn_sel;
        PROCEDURE openCursor IS
            tc t_crs;
            f1 VARCHAR2(50);
            f2 VARCHAR2(50);
        BEGIN
            dyn_sel ('EMP','JOB','MANAGER', tc);
            LOOP
                FETCH tc INTO f1, f2;
                EXIT WHEN tc%notfound;
                dbms_output.put_line (f2);
            END LOOP;
        EXCEPTION
            WHEN OTHERS THEN
                dbms_output.put_line ('exception raised '||SQLERRM);
        END openCursor;
    END dynamic_cursor; -Thanks

    The selected columns must match the INTO clause, so you need to exactly fetch two columns as e.g. in
      stmt := 'select ename, job from ' || tab_name || ' where ' || field_name || ' = :1';
    ....

  • How can i use the same cursor in a loop fro multipletimes.

    I am using two cursors.One to fetch sites and the other to fetch participants under each site.I am performing some job with that participants data.Now the problem is i am using the 2nd cursor in a loop.So it fetches the data of participants falling under one state.But when it comes to the second state,as the second cursor is already open it is unable to fetch the records.Please help me .How can i use the same cursor in a loop fro multipletimes.
    I am sending the code which i have written in When-Button-Pressed-Trigger...
    declare
         sid number;
         pid number;
    cursor csid is select distinct(site_id) from cyber_ppt;
    cursor cpid is select pc_id,st_dt,ed_dt from cyber_ppt where site_id = sid;
         stdt varchar2(10);
         eddt varchar2(10);
         nom number;
         stmonth varchar2(10);
         edmonth varchar2(10);
         cjan number:=0;
         cfeb number:=0;
         cmar number:=0;
         capr number:=0;
         cmay number:=0;
         cjun number:=0;
         cjul number:=0;
         caug number:=0;
         csep number:=0;
         coct number:=0;
         cnov number:=0;
         cdec number:=0;
         i number:=1;
    begin
         open csid ;
         loop
         fetch csid into sid;
              exit when csid %notfound;
              message(sid);
         open cpid;
         loop
         fetch cpid into pid,stdt,eddt ;
         exit when cpid %notfound;
         message(sid||'-'||pid);
         stmonth:=substr(stdt,4,3);
         edmonth:=substr(eddt,4,3);
         nom:= months_between(eddt,stdt);
    while i <= round(nom)
         loop
         stmonth:=substr(stdt,4,3);
    if stmonth='JAN' then
              cjan:=cjan+1;
    elsif stmonth='FEB' then
              cfeb:=cfeb+1;
    elsif stmonth='MAR' then
              cmar:=cmar+1;
    elsif stmonth='APR' then
              capr:=capr+1;
    elsif stmonth='MAY' then
              cmay:=cmay+1;
    elsif stmonth='JUN' then
              cjun:=cjun+1;
    elsif stmonth ='JUL' then
              cjul:=cjul+1;
    elsif stmonth ='AUG' then
              caug:=caug+1;
    elsif stmonth ='SEP' then
              csep:=csep+1;
    elsif stmonth ='OCT' then
              coct:=coct+1;
    elsif stmonth ='NOV' then
              cnov:=cnov+1;
    elsif stmonth ='DEC' then
              cdec:=cdec+1;
    end if;
         stdt:=add_months(stdt,1);
         i:=i+1;
         end loop;
         end loop;
         end loop;
         end;
         

    try this /* untested */
    DECLARE
    sid           NUMBER;
    pid           NUMBER;
    CURSOR csid IS SELECT DISTINCT(site_id) FROM cyber_ppt;
    CURSOR cpid(nSid NUMBER) is SELECT pc_id,st_dt,ed_dt FROM cyber_ppt WHERE site_id = nSid;
    stdt        VARCHAR2(10);
    eddt        VARCHAR2(10);
    nom         NUMBER;
    stmonth     VARCHAR2(10);
    edmonth     VARCHAR2(10);
    cjan         NUMBER:=0;
    cfeb         NUMBER:=0;
    cmar         NUMBER:=0;
    capr         NUMBER:=0;
    cmay         NUMBER:=0;
    cjun         NUMBER:=0;
    cjul         NUMBER:=0;
    caug         NUMBER:=0;
    csep         NUMBER:=0;
    coct         NUMBER:=0;
    cnov         NUMBER:=0;
    cdec         NUMBER:=0;
    i            NUMBER:=1;
    BEGIN
    FOR rec IN csid
    LOOP
                      sid := rec.csid;
    FOR cRec IN cpid(sid)
    LOOP
                     pid := cRec.pc_id;
                     stdt := cRec.st_dt;
                     eddt := cRec.ed_dt;
    stmonth:=  SUBSTR(stdt,4,3);
    edmonth:= SUBSTR(eddt,4,3);
    nom:= months_between(eddt,stdt);
    WHILE i <= round(nom)
    LOOP
              stmonth := SUBSTR(stdt,4,3);
    IF stmonth='JAN'
    THEN
             cjan:=cjan+1;
    ELSIF stmonth='FEB' THEN
             cfeb:=cfeb+1;
    ELSIF stmonth='MAR' THEN
              cmar:=cmar+1;
    ELSIF stmonth='APR' THEN
              capr:=capr+1;
    ELSIF stmonth='MAY' THEN
              cmay:=cmay+1;
    ELSIF stmonth='JUN' THEN
              cjun:=cjun+1;
    ELSIF stmonth ='JUL' THEN
              cjul:=cjul+1;
    ELSIF stmonth ='AUG' THEN
              caug:=caug+1;
    ELSIF stmonth ='SEP' THEN
              csep:=csep+1;
    ELSIF stmonth ='OCT' THEN
              coct:=coct+1;
    ELSIF stmonth ='NOV' THEN
              cnov:=cnov+1;
    ELSIF stmonth ='DEC' THEN
              cdec:=cdec+1;
    END IF;
             stdt:=add_months(stdt,1);
             i:=i+1;
    END LOOP;
    END LOOP;
    END LOOP;
    END;

  • How to use same dynamic text, multiple times in a Movie

    FLASH CS5.5
    How can a dynamic text field be used multiple times, on any
    frame, in any new layer during a Movie?
    ~~
    A number of unique dynamic text fields are being used.
    The intent is to use them each, many times during a Movie.
    (i.e. a users first name)
    They are successfully being "ExternalInterfaced" from a PDF form field.
    (the SWF is displayed within the PDF as a RMA)
    This all works well, IF I only use one instance of the dynamic text field.
    (one use of each unique text field)
    If I try and use that same dynamic text field, again, in a new layer, later in the SWF,
    all of that said, duplicate dynamic text fields do not display.
    ~~
    Stumped!!!
    Thanks in advance for your advice / comments!
    D-

    Thanks Ned,
    I always welcome learning something new.
    I did not know creating a new keyframe,
    creates a new instance.
    Yes, I had used the same dynamic text field instance name in
    numerous, new layers (great observation).
    With the objective to display the User's name throughout
    the timeline (on and off)...
    I'll attempt to paraphrase your solution;
    Use a single layer to display the dynamic text field.
    Extend this layer's timeline throughout the movie, or end use of the dynamic text field.
    Help with this one ??
    Set the visible properties to true or false as need through out the timeline.
    ( Does require an AS3 ? )
    I'll give that a try.....
    ~~
    Side of effect of using the above solution;
    The SWF in it's attempted state, uses the dynamic text field instance, in
    different places, different text sizes, on the stage, throughout the Movie.
    (i.e. the User's first name appears in different sentences...)
    Per the solution above,
    I believe I will be limited to One location, one format setting.
    Is this assumption correct?
    I can make this work from a display / Movie point of view.
    However, your first VAR concept, noted above, might be
    worth exploring should more flexibility be required.
    Thanks for making the time to coach...
    D-

  • How to use the Dynamic Expression in BRFplus

    Hi Experts
                   I am new to BRFplus. Can you give any document on BRFplus how to use the Dynamic Expression.
    Thankyou
    Venkat

    OK I tried it and worked but for one condition:
    WHERE DECODE (E.qualification_sid, 1104,
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    But how to put two conditions for the same Expression:
    WHERE DECODE ((E.qualification_sid, 1104) AND (E.RANK_SID, 8),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.spe_per)+1),
         (TO_DATE(E.RANK_DATE, 'DD-MM-RR')+(365*M.mili_yea_per)+1))
         BETWEEN TO_DATE('01-07-2011', 'DD-MM-RR') AND TO_DATE('31-07-2011', 'DD-MM-RR')
    The previous code gives me this error: missing right parenthesis

  • Paging issues using a dynamic view object...

    I am working on an application that uses JAG to generate JSP pages, i had the requirement to use dynamic view objects where the view object query is generated at runtime. The rest of the application is more or less the same... I used the defult functionality provided by TableScrollButtons.jsp file for paging. Now the problem im facing is that while the '>' and '<' buttons are working fine, i cant seem to navigate to the pages using the drop down...
    With the default handler, whenever i select the range the range displayed remains the same ie 1-10, 10 being the rangesize, but the rows are refreshed with values from the next page. Also, if the next page is the last and is incomplete, then the rows are pushed in from the bottom, so that the last page is always full...I tried the tuning panel in the view object edit dialogue and all settings are fine (i think)...could anyone please tell me what i am doing wrong??

    could it be because i am using a dynamic view object with dynamic bindings? i am using the preparemodel() method in the action as follows...
    protected void prepareModel(DataActionContext ctx) throws Exception {
    inferRangeBindingIfUnset(ctx);
    ctx.getBindingContainer().setEnableTokenValidation(false);
    String sql = ctx.getHttpServletRequest().getParameter("sql");
    String cost=ctx.getHttpServletRequest().getParameter("CostCostCent");
    String event=ctx.getHttpServletRequest().getParameter("event");
    if (sql != null && event == null) {
    setupDynamicQueryAndDynamicBindings(ctx,sql.substring(1),cost);
    if (retrieveOnlyCurrentPageFromDatabase()) {
    ViewObject vo = getIterForPaging(ctx).getViewObject();
    if (vo.getAccessMode() != ViewObject.RANGE_PAGING) {
    vo.setAccessMode(ViewObject.RANGE_PAGING);
    // if(event==null)
    super.prepareModel(ctx);
    ctx.getBindingContainer().setEnableTokenValidation(true);
    if (ctx.getEvents() == null || ctx.getEvents().size() ==0) {
    setPage(ctx,1);
    setLastPage(ctx,getIterForPaging(ctx).getRowSetIterator().getEstimatedRangePageCount());
    else if(event.equals("setRangeStart")) {
    setPageFromRequest(ctx);
    }

Maybe you are looking for

  • Cannot download files from the internet

    Two G4 Macs, both on OS 10.4.6. Desktop (ethernet connection) will not download files/apps -- hit the button and it very quickly flickers and says "done" but nothing has downloaded. Laptop (Airport connection) will download correctly from the same si

  • How to change the language of the reading function in Pages 5.0 (to French in my case) ?

    I'm French and in the new Pages 5.0 there is a reading function (mac reads my document) but the issue is this function uses an English conception of the word and spelling, it changes my text and makes it uncomprehensible. Can someone help me ?

  • Disk icon doesnt show up in ibook 10.2 install

    Hi, I'm trying to reinstall 10.2 on my iBook g3 600mhz. When I boot from the install cd, I get to the point in the installer where I can select the disk to install on, but no disk shows up...The hard drive nor the CD. I've tried wiping the hard drive

  • YTD calculation from BEx is not working in Advance Analysis for OLAP/OR Office

    I have AA for OLAP based on BEx. There are YTD calculation in BEx Designer: User enters Period in variable, and in user exits, the Period Range is populated as "1 ~ UserEnteredValue" in second variable. In BEx, YTD is calculated based on the Restrict

  • Can receive but not send messages using Entourage 2008

    For years I have used Entourage for Mac and it has survived every upgrade and switch to iCloud. Until this week. I did nothing at all to change anything, and all of a sudden, my emails from Entourage are not going out. What happened? How can I fix it