Geting ORA 936 -while building dynamic query in for loop.

HI,
I hav written a SP and its compiled and giving me the results for the data I am quering but giving ORA936 - missing expressin and giving ORA 6512 at 2 lines. Please help me me out where I am going wrong.
CREATE OR REPLACE TYPE LIST as VARRAY(5000) of NUMBER;
CREATE OR REPLACE PROCEDURE test( V_id IN LIST,
v-fdate IN DATE,
v-tdate IN DATE,
v_flg IN CHAR)
AS
TYPE opfld IS RECORD (
FID TAB.ID%TYPE,
FCURR TAB.CURR %TYPE,
FCNT TAB.CNT%TYPE,
FTOT TAB.TOT%TYPE );
TYPE OPLIST IS REF CURSOR;
Rc oplist;
Edtab opfld;
Selstr VACHAR2(200);
Whstr1 VACHAR2(200);
Whstr2 VACHAR2(200);
Whstr3 VACHAR2(200);
Whstr VACHAR2(200);
Grpstr VACHAR2(200);
Andstr VACHAR2(200);
Fullstr VACHAR2(200);
BEGIN
Selstr := ‘SELECT col1,col2,sum(col3),sum(col4) from tab1 ’;
Whstr1 := ‘ WHERE tdate BETWEEN TO_DATE(‘||’’’’||vfdate||’’’’||’)’;
Whstr2: = ‘ AND TO_DATE(‘||’’’’||vtdate||’’’’||’)’;
Whstr := whstr1||whstr2;
Grpstr := ‘GROUP BY col1,col2’;
IF v_flg IS NOT NULL THEN
Whstr3 := whstr||’AND FLAG = ‘||v_flg;
else
Whstr3 := whstr ;
END IF;
FOR I IN 1..id.COUNT LOOP
BEGIN
Andstr := ‘ AND id =’|| v_id(i);
Whstr := whstr3 || andstr ;
Fullstr := selstr||whstr||grpstr;
OPEN rc for fullstr;
LOOP
FETCH rc into edtab
EXIT when rc%NOTFOUND;
END LOOP;
Andstr := ‘’;
Whstr :=’’;
END; ---BEGIN of FOR loop
END LOOP; -- for end
CLOSE rc;
END; -- proc end
Created above SP and its compiled. When I try to execute the SP with below code I am getting--
DECLARE
V_t LIST;
BEGIN
V_t:= LIST();
V_t.EXTEND(10);
V_t(1) := 10;
V_t(2) := 20;
Test(v_t,’25-APR-2012’,’30-APR-2012’,’Y’);
END;
The SP is building correct dynamic querry and its getting executed for id = 10 and 20, giving the correct results but though I defined only 2 ids while executing and written FOR lOOP upto ID.COUNT its building query for third time and that time its not getting id, so for the third time the last part of where clause is built like
SELECT.....
WHERE....
AND id = (its taking blank here)
GROUP BY ...;
and thus its giving me ORA 936 missing expression and ORA 06152 at line of RECORD TYPE declaration and line of OPEN rc for fullstr;
ERROR at line 1
ORA 00936 misssing expresiion
ORA 006152 at line 9
ORA 006512 at line 87
I hav put DBMS_OUTPUT statements @ every build of dynamic wuery and its correct. here I have not copid the code I hav typed hereso not wriiten DBMS_OUTPUT.
I tried lot of ways redefining Andstr := ‘’;
Whstr :=’’; after for endloop but its giving the same error. is this because I am using varray? If am providing 2 ids in anonymous block then how its building query for third blank ID value.
Please help me out here..
Thanks a lot..

>
I hav written a SP and its compiled and giving me the results for the data I am quering
>
Then you should have posted the one that compiles and gives you results.
The code you posted will not compile without errors. Edit your original post and provide the corrected code.
When you do please add \ tags on the line before and after the code to preserve formatting. See the FAQ for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Using Dynamic Query in For Loop

    I have a doubt whether i can use the result from dynamic query in the for loop.
    for example,
    declare
    v_sql varchar2(1000);
    v_Id INTEGER;
    begin
    v_sql := 'select id from table1 where id in ('||v_Id||')';
    FOR i in vsql LOOP
    dbms_output.put_line(i.id);
    end loop;
    end;
    The above query is possible ?

    And here's a basic example of opening up a cursor for your dynamic query...
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    v_sql varchar2(2000);
      3    v_cur sys_refcursor;
      4    i     emp.sal%type;
      5  begin
      6    v_sql := 'select sal from emp';
      7    open v_cur for v_sql;
      8    loop
      9      fetch v_cur into i;
    10      exit when v_cur%NOTFOUND;
    11      dbms_output.put_line('Salary: '||i);
    12    end loop;
    13* end;
    SQL> /
    Salary: 800
    Salary: 1600
    Salary: 1250
    Salary: 2975
    Salary: 1250
    Salary: 2850
    Salary: 2450
    Salary: 3000
    Salary: 5000
    Salary: 1500
    Salary: 1100
    Salary: 950
    Salary: 3000
    Salary: 1300
    PL/SQL procedure successfully completed.
    SQL>

  • Build dynamic query depending upon selection of table and columns

    Hi ,
    I want your views on following requirement :
    we r doing generic export to excel functionality .
    1.User will select multiple tables and according to tables ,columns on that table will select
    2.There can be multiple table
    3.depending upon column and table selection , we have to build dynamic query and execute .
    Please let me know is it possible .If yes then please tell me how to do above requirement.
    Thanks in advance

    Hi,
    Identifiers cannot be used as bind variables, query are parsed
    before evaluate bind variables. Identifiers like table name.
    For excel you can use some like this:
    SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    SPOOL test_xls.xls
    SELECT colum1||chr(9)||columN FROM tableName;
    or CSV:
    SELECT colum1|| ',' ||columN FROM tableName;
    SPOOL OFF
    SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
    For construct the query i suggest to read "Dynamic SQL Statements":
    http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-Statements/0300__Dynamic-SQL.htm
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:227413938857
    --sgc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Error  while building the default domain for intigrated weblogic server

    Hi,
    An error occurred while building the default domain for integrated weblogic server
    log file contains fallowing details about error
    "C:\Oracle\Middleware\oracle_common\common\bin\wlst.cmd" "C:\Oracle\Middleware\jdeveloper\MyWork\system11.1.1.5.38.61.26\o.j2ee.adrs\CreateDefaultDomain.py"
    Process started
    wlst >
    wlst > CLASSPATH=C:\Oracle\Middleware\patch_wls1035\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\Oracle\Middleware\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\Oracle\Middleware\jdk160_24\lib\tools.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic_sp.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\modules\features\weblogic.server.modules_10.3.5.0.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\webservices.jar;C:\Oracle\Middleware\modules\org.apache.ant_1.7.1/lib/ant-all.jar;C:\Oracle\Middleware\modules\net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar;;C:\Oracle\Middleware\oracle_common/modules/oracle.jrf_11.1.1/jrf-wlstman.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\adf-share-mbeans-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\adfscripting.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\applcore-diagnostics-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\mdswlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\auditwlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\igfwlsthelp.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\jps-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\jrf-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\oamap_help.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\oamAuthnProvider.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ossoiap.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ossoiap_help.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ovdwlsthelp.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\sslconfigwlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\wsm-wlst.jar
    wlst >
    wlst > PATH=C:\Oracle\Middleware\patch_wls1035\profiles\default\native;C:\Oracle\Middleware\patch_jdev1111\profiles\default\native;C:\Oracle\Middleware\wlserver_10.3\server\native\win\32;C:\Oracle\Middleware\wlserver_10.3\server\bin;C:\Oracle\Middleware\modules\org.apache.ant_1.7.1\bin;C:\Oracle\Middleware\jdk160_24\jre\bin;C:\Oracle\Middleware\jdk160_24\bin;;C:\Oracle\Middleware\wlserver_10.3\server\native\win\32\oci920_8
    wlst >
    wlst > Your environment has been set.
    wlst >
    wlst > CLASSPATH=C:\Oracle\Middleware\patch_wls1035\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\Oracle\Middleware\patch_jdev1111\profiles\default\sys_manifest_classpath\weblogic_patch.jar;C:\Oracle\Middleware\jdk160_24\lib\tools.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic_sp.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\modules\features\weblogic.server.modules_10.3.5.0.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\webservices.jar;C:\Oracle\Middleware\modules\org.apache.ant_1.7.1/lib/ant-all.jar;C:\Oracle\Middleware\modules\net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar;;C:\Oracle\Middleware\oracle_common/modules/oracle.jrf_11.1.1/jrf-wlstman.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\adf-share-mbeans-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\adfscripting.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\applcore-diagnostics-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\lib\mdswlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\auditwlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\igfwlsthelp.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\jps-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\jrf-wlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\oamap_help.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\oamAuthnProvider.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ossoiap.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ossoiap_help.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\ovdwlsthelp.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\sslconfigwlst.jar;C:\Oracle\Middleware\oracle_common\common\wlst\resources\wsm-wlst.jar;C:\Oracle\Middleware\utils\config\10.3\config-launch.jar;C:\Oracle\Middleware\wlserver_10.3\common\derby\lib\derbynet.jar;C:\Oracle\Middleware\wlserver_10.3\common\derby\lib\derbyclient.jar;C:\Oracle\Middleware\wlserver_10.3\common\derby\lib\derbytools.jar;;
    wlst >
    wlst > Initializing WebLogic Scripting Tool (WLST) ...
    wlst >
    wlst > Welcome to WebLogic Server Administration Scripting Shell
    wlst >
    wlst > Type help() for help on available commands
    wlst >
    wlst > Creating Default Domain
    wlst > Reading template: /C:/Oracle/Middleware/wlserver_10.3/common/templates/domains/wls.jar
    wlst > Setting Name to 'DefaultServer'
    wlst > Setting ListenAddress to ''
    wlst > Setting ListenPort to 7101
    wlst > Setting domain administrator to 'FAAdmin'
    wlst > Setting domain password.
    wlst > Problem invoking WLST - Traceback (innermost last):
    wlst > File "C:\Oracle\Middleware\jdeveloper\MyWork\system11.1.1.5.38.61.26\o.j2ee.adrs\CreateDefaultDomain.py", line 59, in ?
    wlst >      at com.oracle.cie.domain.script.jython.WLSTSecurityPrincipal.set(WLSTSecurityPrincipal.java:70)
    wlst >
    wlst >      at com.oracle.cie.domain.script.jython.WLSTSecurityUser.setPassword(WLSTSecurityUser.java:33)
    wlst >
    wlst >      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    wlst >
    wlst >      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    wlst >
    wlst >      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    wlst >
    wlst >      at java.lang.reflect.Method.invoke(Method.java:597)
    wlst >
    wlst >
    wlst > com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.jython.WLSTException: java.lang.Exception: The password must be at least 8 alphanumeric characters with at least one number or special character.
    wlst >
    rohit

    Hi,
    you see that message: "The password must be at least 8 alphanumeric characters with at least one number or special character." ?
    The password: The weblogic password you provide when prompted
    must be at least: minimal condition for secure passwords enforced on WLS by default
    at least 8 alphanumeric characters: no 7 but eight or more characters
    with at least one number or special character: password should have a number in it or an "@" "-" or similar
    E.g.
    weblogic1
    is one password option that would meet that requirement
    Frank

  • Error ORA-01652 while running select query

    A select query returning millions of records is returning the following error.
    SQL Error [
    ORA-01652: unable to extend temp segment by 128 in tablespace TEMP
    We requested DBA to increased the TEMP tablespace. He increased it to 20GB and also, changed to Autoextent.
    When we executed the query again, we got the same error ?
    What could be the reason of this issue and how it can be resolved ?

    All sort operations that don't fit into the SORT_AREA_SIZE will go to the temp tablespace (they can be seen as direct writes in the trace file).
    It can easy be the case, that your temp tablespace needs to be many GB in size [we have a table with millions of rows and for the loading/merging our temp is 80GB in size].
    May be you can change your process of loading i.e. with this select you fill a intermediate table (with CTAS) and do your processing there or even try to do the processing in SQL while building the table. You could also try to do the processing with a cursor and BULK COLLECT LIMIT 100 and then inserting into the target table with the FORALL statement.

  • Error while running a query-Input for variable 'Posting Period is invalid

    Hi All,
    NOTE: This error is only cropping up when I input 12 in the posting period variable selection. If I put in any other value from 1-11 I am not getting any errors. Any ideas why this might be happening?
    I am getting the following error when I try and run a query - "Input for variable 'Posting Period (Single entry, mandatory)' is invalid" - On further clicking on this error the message displayed is as follows -
    Diagnosis
    Variable Posting Period (Single Value Entry, Mandatory) is used as a lower limit (X) and an upper limit () in an interval selection. This limit has the value #.
    System Response
    Procedure
    Enter a different value for variable Posting Period (Single Value Entry, Mandatory). If the value of the other limit is determined by another variable, you can change its value also.
    Procedure for System Administration

    OK.
    Well, if the variable is not used in any interval selection, then I would say "something happened to it".
    I would make a copy of the query and run it to check if I get the same problem with period 12.
       -> If not, something is wrong in the original query (you can proceed as below, if changes to original are permitted).
    If so, then try removing the variable completely from the query and hardcode restriction to 12.
       -> If problem still persists, I would have to do some thinking.
    If problem is gone, then add the variable again. Check.
       -> If problem is back, then the variable "is sick". Only quick thing to do, is to build an identical variable and use that one.
    If problem also happens with the new variable, then it's time to share this experience with someone else and consider raising an OSS.
    Good luck!
    Jacob
    P.S: what fisc year variant are you using?
    Edited by: Jacob Jansen on Jan 25, 2010 8:36 PM

  • Dynamic query table for report based on LOV selected

    Hi,
    Need some suggestion and guidance how to dynamically query table via lov for report .
    Scenario:
    Table, TABLE_LIST, has tablename (table in DB) and filter (for where clause) column. The TABLENAME_LOVE is derived from table TABLE_LIST.
    SELECT TABLENAME D, TABLENAME R FROM TABLE_LIST
    In Page 2,a page select list item,P2_TABLENAME to use TABLENAME_LOV
    All data in tables in the table_list have identical structure (columns, triggers, primary key, and so on).
    I want to have the report region query from the table based on selected LOV.
    Example,
    Tablename Filter
    TB1
    CD2 ACTIVE='Y'
    When select TB1, the report regin will query based on TB1.
    When select CD2, the report regin will query based on CD2 WHERE ACTIVE='Y'
    Question:
    How can I query based on &P2_TABLENAME. WHERE &P2_FILTER.
    Like
    select col1, col2 from &P2_TABLENAME WHERE &P2FILTER
    Greatly appreciate any suggestion and some guidance.
    Tigerwapa

    Hi,
    You should always post your Apex version, DB version and other information as suggested in the FAQ.
    And the moment you talk report you should state whether it is IR or Classic.
    As for your query, have you explored the Report type "SQL Query (PL/SQL function body returning SQL query)" ?
    That might be a good fit for what you are trying to achieve.
    Regards,

  • How to build dynamic time series for the time dimension

    I am planning to build dynamic time series using rule file instead of manually.Please let me know if there is any property need to assign to enable DTS property for TIME dimension.
    Edited by: 844104 on Mar 14, 2011 3:37 AM

    In the load rule in the dimension build settings you would need to go to the tab dimension definition, choose the time dimension and right click on it. Select Edit properties. If you have not done so, set the dimension to be the time dimension. Then go to the generations/levels tab and set the generation names you need. For example if you want YTD, you would set the generation name to Year, if you want QTD set it to Quarter. You would set the number to the generation number that coorisponds to the generation. The DBAG has the list of names for all of the DTS members.

  • Process having dynamic subqery in for loop cursor

    I created a process that puts all retrieved rows into a collection. Users can select on quite a few columns, say unit, last_name, shift, etc. When the query is built based on users' inputs, I can't get it working using a For Loop Cursor (code 3.). But I tried and found out that sample 1 is working while sample 2 is not.
    Can anyone please help? give advices or point to the right direction?
    Thanks very much in advance!!!
    DC
    sample 1, works:
    begin
    :P8_TEST_CURSOR := '';
    for c in ( select ename from emp ) loop
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || c.ename;
    end loop;
    end;
    sample 2, does not work:
    declare
    q varchar2(2000) := 'select ename from emp';
    begin
    :P8_TEST_CURSOR := '';
    for c in q loop
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || c.ename;
    end loop;
    end;
    code 3, my actually pursuing code, sorry it's long:
    declare
    q varchar2(2000);
    v_unit_id cpd_units.id%TYPE;
    begin
    q := 'select distinct e.user_id
    , nvl(to_char(law_common.get_star_no(e.id)), ''-'') star_no
    , nvl(e.last_nme, ''-'') last_name
    , nvl(e.first_nme, ''-'') first_name
    , nvl(e.MIDDLE_INITIAL, ''-'') middle_initial
    , e.employee_no
    , nvl(to_char(e.employee_position_cd), ''-'')
    , nvl(w.uod_cd, e.cpd_unit_assigned_no) unit
    , nvl(w.watch_cd, ''-'')
    from cpd_employees e, dpv2wtch w
    where e.status_i = ''Y''
    and nvl(e.resignation_date, sysdate) >= sysdate
    and e.employee_position_cd in (''9112'', ''9152'', ''9153'', ''9155'', ''9161'', ''9164'')
    and e.user_id is not null
    and w.ssn_no(+) = e.ssn
    and e.user_id not in (select c001
    from htmldb_collections
    where collection_name = ''ACTIVITY''
    if :P300_STAR_NO is not NULL then
    q := q || ' and e.id = law_common.get_employee_id(:P300_STAR_NO)';
    --q := q || ' and law_common.get_star_no(e.id) = :P300_STAR_NO';
    end if;
    if :P300_EMPLOYEE_NO is not NULL then
    q := q || ' and e.employee_no = :P300_EMPLOYEE_NO';
    end if;
    if :P300_USER_ID is not NULL then
    q := q || ' and e.user_id = :P300_USER_ID';
    end if;
    if :P300_LAST_NAME is not NULL then
    q := q || ' and upper(e.last_nme) like ''' || upper(:P300_LAST_NAME) || '%''';
    end if;
    if :P300_FIRST_NAME is not NULL then
    q := q || ' and upper(e.first_nme) like ''' || upper(:P300_FIRST_NAME) || '%''';
    end if;
    if :P300_EMPLOYEE_POSITION_CD is not NULL then
    q := q || ' and e.employee_position_cd = :P300_EMPLOYEE_POSITION_CD';
    end if;
    if :P300_UNIT is not NULL then
    q := q || ' and nvl(w.uod_cd, e.cpd_unit_assigned_no) = :P300_UNIT';
    end if;
    if :P300_WATCH_CD <> 'NULL' then
    q := q || ' and w.watch_cd = :P300_WATCH_CD';
    end if;
    --htp.p('Limit Unit '||:P0_LIMIT_UNIT);
    /* authorization of editing OWN, UNIT, or ALL recs */
    if substr(:P0_PERMISSION, 1, 5) = 'QUERY' then
    q := q || ' and e.user_id = v(''FLOW_USER'')';
    elsif substr(:P0_PERMISSION, -4, 4) = 'UNIT' then
    q := q || ' and coalesce(w.uod_cd, e.cpd_unit_assigned_no)= :P0_LIMIT_UNIT ';
    end if;
    htp.p('q: ' || q);
    cursor q_c is q;
    for c in ( q_c ) loop /* HOW CAN BE DYNAMIC ???? */
    l_seq_id := htmldb_collection.add_member(
    p_collection_name => 'OFFICER_ACTIVITY'
    , p_c001 => c.user_id
    , p_c002 => c.star_no
    , p_c003 => c.last_name
    , p_c004 => c.first_name
    , p_c005 => c.middle_initial
    , p_c006 => c.employee_no
    , p_c007 => c.employee_position_cd
    , p_c008 => c.unit
    , p_c009 => c.watch_cd
    , p_c050 => :P0_APP_USER
    end loop;
    end;

    Come back to solve my need. I get the working test process:
    declare
    type ty_cursor is ref cursor;
    my_cursor ty_cursor;
    my_rec emp%rowtype;
    l_num number := 7900;
    q varchar2(2000) ;
    l_using varchar2(200) := null;
    begin
    :P8_TEST_CURSOR := '';
    q := 'select * from emp';
    if :P8_ENAME is not null then
    q := q || ' where ename like :P8_ENAME';
    l_using := ':P8_ENAME';
    end if;
    if l_using is not null then
    open my_cursor for q using :P8_ENAME; --l_using;
    else
    open my_cursor for q;
    end if;
    loop
    fetch my_cursor into my_rec;
    exit when my_cursor%notfound;
    :P8_TEST_CURSOR := :P8_TEST_CURSOR || ', ' || my_rec.empno;
    end loop;
    end;
    But I need
    open my_cursor for q using l_using;
    to be working since my application has several searchable columns for users and I have to put users' input search into l_using. It does NOT work: q got 'select * from emp where ename like :P8_ENAME' and l_using got ':P8_ENAME' at "open ...." statement.
    How can I get this cursor opened dynamically?
    Thanks again!
    DC

  • Build 1D array using for loop

    Hi guys,
    I am testing out array. How do I create a 1D array of x-y using for loop?

    Nextal wrote:
    I am testing out array. How do I create a 1D array of x-y using for loop?
    OK, first of all you did not say what the array should contain. If you want an array that has one array element for each iteration of the while loop, you need to first think a bit harder. Your outer loop has no wait, thus it will spin millions of times per second and you will run out of memory soon, no matter how much memory you have. How many times should the while loop iterate? If you know the number before the program starts, you would use a FOR loop and autoindex at the loop boundary.
    If you want to use a whiile loop, you need a mechanism to keep the array size reasonable. For small final arrays, you can just build the array in a shift register if you need it updated as it happens. If you only need the array after the loop stops, you can autoindex at the right loop boundary.
    In any case, you should take a step back and decide what you really want. Currently the specifications are very vague and unreasonable.
    LabVIEW Champion . Do more with less code and in less time .

  • Breaking a single query using for loop to improve performance

    Hi,
    This is a continuation of my previous post which I marked Answered and few things are were left from my side and I was advised to post a new thread...
    [Will it be a good ply|http://forums.oracle.com/forums/thread.jspa?threadID=880922&tstart=0]
    will it be applicable to any query because I took this to simplify the thing to explain my case
    which is actually........... pull the data from some tables using joins and insert into some other tables .....
    I used few procedures for diff conditions one of them use plain' insert into select' and others use bulk collect technique.
    I followed the simple strategy (for DML ) by Tom Kytes ..and Steven Feuerstein
    Use single statement whenever it is possible..
    if not use PL/SQL with bulk collect to avoid for loop.
    Please correct me if I am wrong.
    Thanks and Regards,
    Hesh.

    A simple test can prove the case
    SQL> set serveroutput on
    SQL>
    SQL> create table t
      2  as
      3  select * from all_objects where 1=2
      4  /
    Table created.
    SQL> declare
      2    ltime integer;
      3  begin
      4      ltime := dbms_utility.get_time;
      5      insert into t select * from all_objects;
      6      ltime := dbms_utility.get_time - ltime;
      7
      8      dbms_output.put_line(ltime);
      9  end;
    10  /
    187
    PL/SQL procedure successfully completed.
    SQL> rollback
      2  /
    Rollback complete.
    SQL> declare
      2      ltime integer;
      3      type tbl is table of t%rowtype index by pls_integer;
      4      l_tbl tbl;
      5      cursor c
      6      is
      7      select * from all_objects;
      8  begin
      9      ltime := dbms_utility.get_time;
    10      open c;
    11      loop
    12          fetch c bulk collect into l_tbl limit 500;
    13          exit when c%notfound;
    14
    15          forall i in 1..l_tbl.count
    16            insert into t values l_tbl(i);
    17      end loop;
    18
    19      ltime := dbms_utility.get_time - ltime;
    20
    21      dbms_output.put_line(ltime);
    22  end;
    23  /
    390
    PL/SQL procedure successfully completed.
    SQL> rollback
      2  /
    Rollback complete.

  • What is the best way to pass a controllin​g signal out of a sub vi or more than one layer of for loop, while the sub vi or for loops are still running?

    I have a vi that runs through two for loops and a while loop, then after a certain number of iterations on the inner while loop it is supposed to pass a trigger to a case stucture to start measurement. I have tried using a local variable attached to a boolean control which in turn is attached to the true case of the case structure involving the measurement sub vi. What is happening is that the boolean control will light on the front panel at the correct # of iterations in the while loop, as if true, but the measurement is not taken, and the boolean control never goes back to false. It remains lit. Am I u
    sing the local variable incorrectly? If so, where am I going wrong.
    Attachments:
    GL_Flicker.vi ‏118 KB
    Take_Measurements.vi ‏147 KB

    Hello planar,
    There are multiple ways to pass control information between loops and VIs and each one has its place. For simple VIs like your example, a local variable will be fine.
    The main reason the subVI is not running is that the case structure is not continuously polling the Boolean control. This is because the case structure is not inside a loop and as such will only read the Boolean value once and execute once. Encasing the case structure and control inside the while loop should solve the issue of the subVI not running.
    You may find the following links of help in creating more robust and advanced VI architectures.
    Application Design Patter
    ns: Master/Slave
    LabVIEW Application Design Patterns
    Keep up to date on the latest PXI news at twitter.com/pxi

  • How to build dynamic query strings in the query using DB adapter 'Pure SQL'

    Dear Forum,
    I am building an application which will access DB to fetch some result set. The query involves retrieving data from multiple tables(nearly 10 tables). So I have created a DB adapter using 'execute pure sql' option. With this query works fine, but my inputs parameters will vary. So I need to make my query dynamic to append the query strings at runtime depending on the inputs.
    For example I have 3 input variables - input1,input2 and input3 (in my request xsd) which are used in the pure sql query. Now if I get a 4th input parameter input4 in the request, I need to append this to query string as 'AND input4=[some value]' at runtime. Otherwise my query should have only 3 parameters. Please suggest how this can be achieved.
    Regards,
    Satya.

    This is a strange requirement, depending on the columns you have and what are optional in them, one way is to have separate operations and each opeartion will have different inputs and for each operation , a different DB Adapter is called. But this way, it results in more number of operations for the service as well as more number of references in the composite. Even if you pass the column inputs to the SQL procedure, it will result in a large number of if-else cases..
    Thanks,
    N

  • Getting ORA Error while running any Query

    Hi Experts - I am getting below error message for any query i run in Webi. Please help.
    failed to execute with the error ORA-00604: error occurred at recursive SQL level 1
    ORA-01655: unable to extend cluster SYS.C_OBJ#_INTCOL# by 128 in tablespace. (WIS 10901)

    Hello communutiy, hello rohan,
    after updating patches next working day we also get this erreor message
    "ORA-00604: error occurred at recursive SQL level 1 ORA-01655: unable to extend cluster SYS.C_OBJ#_INTCOL# by 128 in tablespace"
    What have you done so far. Could you solve this issue? If yes how?
    Best regards Harry

  • Build Dynamic Query based on values of multiselect list

    I am trying to implement the same functionality as shown in this app.
    http://htmldb.oracle.com/pls/otn/f?p=9741:6:13406902443304236283:::::
    I have hit a brick wall when I try to set the value of my text area/select statement, even after viewing the detail section in above app.
    Does anybody know exactly how I can set the value of a text area from multiselect list values??

    Hi Sam,
    check out How to use multi select in a query report
    See also Denes sample application which has and example where you can still do an index access if a index is defined for the column. http://htmldb.oracle.com/pls/otn/f?p=31517:138
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

Maybe you are looking for

  • Hold Button Not Working

    The hold button on my iPod video recently stopped working for no reason I can see (I've never dropped my iPod or gotten it wet or anything). Essencially, when I switch the hold button on, nothing happens (it certainly does not lock the buttons and th

  • Roles of Implementation & Support  Project  of demand planner

    hi to all              i let to know whats the exact job of a Planner in Implementation & Supporting project his roles and responsibility and i want to know exactly that what do he do in real time project of I & S. please answer for my query and expe

  • Replacing a System Font

    Hello, We've been having some font issues and I think I'm close to clearing them up but have a question. We use FontAgent Pro and in that, we have a Helvetica font and a Helvetica Neue font. Both of which are also System fonts. I did the Restore Stan

  • ITunes Response time is very slow while downloading.

    When iTunes is preforming some task it is not responsive on Windows 7. For example:  When it is downloading a program I click one of the libraries it can take up to 1 minute before that item is selected and the screen goes to that selection.  It appe

  • Could not load file or assembly Oracle.DataAccess

    Hi, I have a web project in Visual Studio 2008 for .NET Framework 3.5 using ODP.NET. The app has been working under a 32bit machine with the 10.2 client for a few years. We are moving to new servers which are 64bit and require the 11.2 client. I am t