How to Use SPOOL Command with Bind Variables

For the Following SPOOL I want the GEN_DATE to be entered by the User at the time of execution of the SQL Script. Is it possible in SPOOL Command.
set colsep , -- separate columns with a comma
set pagesize 1000 -- get rid of disturbing ---- between pages
set heading on -- Print column heading
set trimspool on -- remove trailing blanks. eliminating the spaces up to eol
set linesize 700 -- line size should be the sum of the column widths
spool spool_results.csv
SELECT *
FROM GUI_SITE_JOURNAL
WHERE GENDATE_ BETWEEN '2012-11-01 00:00:00:00000' AND '2012-11-02 00:00:00:00000'* ORDER BY GEN_DATE;
spool off;
The reason is to give the ability to user so that he can enter any range without modifying the code of the script.
Can Any one help me please.
Edited by: user10903866 on Feb 18, 2013 7:44 PM

Hi,
user10903866 wrote:
For the Following SPOOL I want the GEN_DATE to be entered by the User at the time of execution of the SQL Script. Is it possible in SPOOL Command.Do you want the user input in the SPOOL command, or do you want it in the query?
set colsep , -- separate columns with a comma
set pagesize 1000 -- get rid of disturbing ---- between pages
set heading on -- Print column heading
set trimspool on -- remove trailing blanks. eliminating the spaces up to eol
set linesize 700 -- line size should be the sum of the column widths
spool spool_results.csv
SELECT *
FROM GUI_SITE_JOURNAL
WHERE GENDATE_ BETWEEN '2012-11-01 00:00:00:00000' AND '2012-11-02 00:00:00:00000'* ORDER BY GEN_DATE;What is the data type oif gen_date?
If it's a string, that's a big mistake. Information about dates belongs in DATE columns.
If it's a DATE, then don't try to compare it to strings, such as '2012-11-01 00:00:00:00000' .
spool off;
The reason is to give the ability to user so that he can enter any range without modifying the code of the script.
Can Any one help me please.One way to do that is with substitution variables:
SET     VERIFY  OFF
ACCEPT  start_gen_date     PROMPT "Starting date (e.g., 2013-02-18 23:00:00.00000): "
ACCEPT  end_gen_date     PROMPT "Ending date   (e.g., 2013-02-18 23:59:59.99999): "
SPOOL  spool_results.csv
SELECT    *
FROM        gui_site_journal
WHERE        gen_date  BETWEEN '&start_gen_date'
                AND     '&end_gen_date'
ORDER BY  gen_date;
SPOOL  OFFThere are security considerations. Substitution variables give devious users the power to issue any SQL command, such as DROP TABLE. Users that have SQL*Plus access already have that power, anyway.

Similar Messages

  • Using a query with bind variable with columns defined as raw

    Hi,
    We are on Oracle 10.2.0.4 on Solaris 8. I have a table that has 2 columns defined as raw(18). I have a query from the front end that queries these two raw columns and it uses bind vairables. The query has a performance issue that I need to reproduce but my difficulty is that how to test the query in sqlplus using bind variables (the syntax for bind vairables fails for columns with raw datatype).
    SQL> DESC TEST
    Name                                      Null?    Type
    ID1                                                RAW(18)
    ID2                                                RAW(18)
    SQL> variable b1  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    The above is the error I get - i cant declare a variable as raw.
    SQL> variable b2  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    SQL> variable b3  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    --now the actual query below
    SQL> SELECT * FROM TEST WHERE ID1=:B1 AND ID2 BETWEEN :B2 AND :B3;
    SP2-0552: Bind variable "B3" not declared.
    (this fails due to the errors earlier)Also this is a third party app schema so that we don't have the option of modifying the data type of the columns.
    Thanks,
    Edited by: orausern on May 10, 2011 11:30 AM

    Try anonymous PL/SQL block:
    declare
    b1 RAW(18);
    b2 RAW(18);
    b3 RAW(18);
    begin
    b1:=..;
    b2:=..;
    b3:=..;
    SELECT col1, col2, ..
    INTO ...
    FROM TEST
    WHERE ID1=:B1
    AND ID2 BETWEEN :B2 AND :B3;
    end;
    /

  • How to  define and work with bind-variables without the dialog-box ?

    I want to select different tables with the same bind_variables,
    but do want not fill the bind-variables-dialogbox
    everytime I use the select statements
    because I could simple edit and bind this bind-variables once
    at the first select.
    select col1, col2 into :bind1, :bind2 from mybasictable_10 where col3 = 'ABCD':
    select * from mytable_b where b1 = :bind1 and b2 = :bind2 ;
    select * from mytable_c where c1 = :bind1 and c2 = :bind2 ;
    select * from mytable_d where d1 = :bind1 and d2 = :bind2 ;
    select * from mytable_e where e1 = :bind1 and e2 = :bind2 ;
    it doesn't work and I didn't find that in help,
    how does it work in sql-developer ?
    regards

    david,
    back to the root of my question:
    I do use an 10 years old low-end sql / plsql-tool where I can simple and fast do sql-things like that:
    select col1, col2 into :bind1, :bind2 from mybasictable_10 where col3 = 'for_example_ABCD':
    select * from mytable_b where b1 = :bind1 and b2 = :bind2 ;
    select * from mytable_c where c1 = :bind1 and c2 = :bind2 ;
    select * from mytable_d where d1 = :bind1 and d2 = :bind2 ;
    select * from mytable_e where e1 = :bind1 and e2 = :bind2 ;
    I would like to use oracles SQL-Developer instead of this 'old' tool,
    and want to use my 'old' sql / plsql scripts
    but the SQL-Developer in this matter seems is to much complicate to use,
    I can do complex and big things with sql-dev,
    but not simple using bind-variables ;-)( .

  • Using pipelined functions with bind variables in Apex...

    Hy all:
    I have a table which has about 10 million records and it is hanging up the system when it is trying to retrieve the data from that table... so what I have done is I created a pripelined
    function and then trying to retrieve data using an SQL statement ... when I try to use a bind variable to filter by the date and location it is binding according to the location
    but not by date ... can anyone help me in this please!!
    Help greatly appreciated !
    Thanks in advance !

    Hi Denes:
    Create or replace type ohe1 as object (
    IMLITM NCHAR(50), IMAITM NCHAR(50), IMDSC1 NCHAR(60), COUNCS NUMBER(22), LIPQOH NUMBER(22),
    LIMCU NCHAR(24), LILOCN NCHAR(40), LILOTN NCHAR(60), LILOTS NCHAR(2), IOMMEJ NUMBER(22))
    CREATE OR REPLACE TYPE OHE AS TABLE OF Ohe1
    CREATE OR REPLACE FUNCTION GET_ohe
    return OHE PIPELINED
    IS
    m_rec ohe1:= ohe1 (NULL,NULL,NULL,0,0,NULL,NULL,NULL,NULL,0);
    begin
    for c in (select f1.LITM LITM, F1.AITM AITM, F1.DSC1 DSC1, F5.UNCS UNCS,
    F21.QOH QOH, F21.MCU MCU, F21.LOCN LOCN, F21.LOTN LOTN, F21.LOTS LOTS,
    F8.MEJ MEJ FROM F1 F1, F2 F2, F21 F21, F5 F5, F8 F8
    WHERE (F5.EDG='07') AND (F21.QOH != 0) AND F2.IBITM = F1.IMITM
    AND F21.ITM = F2.ITM AND F21.ITM = F5.ITM AND F21.MCU = F5.MCU
    AND F21.MCU = F2.MCU AND F21.LOTN = F8.LOTN AND F21.MCU = F8.MCU)
    loop
    m_rec.LITM:=c.LITM;
    m_rec.AITM:=c.AITM;
    m_rec.DSC1:=c.DSC1;
    m_rec.UNCS:=c.UNCS;
    my_record.QOH:=c.QOH;
    my_record.MCU:=c.MCU;
    my_record.LOCN:=c.LOCN;
    my_record.LOTN:=c.LOTN;
    my_record.LOTS:=c.LOTS;
    my_record.MEJ:=c.MEJ;
    PIPE ROW (my_record);
    end loop;
    return;
    end;
    select LITM , AITM , DSC1 , UNCS*.0001 UNCS, QOH*.0001 QOH, (UNCS*.0001)*(QOH*.0001) AMOUNT,
    MCU MCU, LOCN LOCN, LOTN LOTN, LOTS LOTS, jdate(DECODE(MEJ,0,100001,MEJ)) MEJ FROM
    TABLE (GET_ohe)
    WHERE trim(LIMCU)= TRIM(:OHE_BRANCHID)
    AND (jdate(DECODE(MEJ,0,10001,MEJ)) >=:FROMEXPDT
    AND jdate(DECODE(MEJ,0,10001,MEJ)) <=:TOEXPDATE)
    The MEJ is a julian date and I am trying to convert it into a date ..... using the function jdate! and the pipelined function is created without any errors
    and I am able to get the data with correct branch location bind variable but only problem is it is not binding the date filters in the sql.....
    Thanks
    Edited by: user10183758 on Oct 16, 2008 8:17 AM

  • How to use function v( ) for bind variable 30 char

    I have the following process, try to load columns from table to the page. One of the column complains about > 30 char cannot use bind variable. I change to
    V('c1.OBJ_OUT_SOURCIING_WAD_TYPE') but still not work.
    Please help;
    BEGIN
    FOR c1 in ( SELECT *
    FROM #OWNER#.OBJECT_OUT_SOURCING
    WHERE OBJ_NAME = :P503_OBJ_NAME AND
    OBJ_OWNER = :P503_OBJ_OWNER AND
              DATABASE_NAME = :P503_DATABASE_NAME)
    LOOP
    :P503_OBJ_NAME := c1.OBJ_NAME;
    :P503_OBJ_OWNER := c1.OBJ_OWNER;
    :P503_DATABASE_NAME := c1.DATABASE_NAME;
    :P503_APPL_NAME := c1.APPL_NAME;
    :P503_OBJ_TYPE := c1.OBJ_TYPE;
    :P503_OBJ_OUT_SOURCIING_WAD_TYPE := V('c1.OBJ_OUT_SOURCIING_WAD_TYPE');
    END LOOP;
    END;

    Che-Hwa,
    Change this statement:  :P503_OBJ_OUT_SOURCIING_WAD_TYPE := V('c1.OBJ_OUT_SOURCIING_WAD_TYPE'); to:  htmldb_application.update_cache_with_write(p_name=>'P503_OBJ_OUT_SOURCIING_WAD_TYPE',p_value=>c1.P503_OBJ_OUT_SOURCIING_WAD_TYPE);Scott

  • How to querie with bind variable in findMode?

    Hallo,
    is it possible to use a querie with bind variable in findMode? And when how is it possible to initialize the bind variable?
    Any help is appreciated.

    Hi,
    bind variables can be linked from teh ADF binding to e.g. a managed bean, the sessionScope or other binding attributes via EL. So when you go into findMode and execute the query, the EL will grab the bindVariable values automatically.
    Frank

  • Detail view with bind variable. TreeTable not showing all detail result.

    I’m having trouble with treeTable using detail view with bind variables and where clause defined in VO definition.
    Both, master and detail view objects, base on the same entity and have the same condition in where clause. The view objects also have bind variables, which are set in prepareRowSetForQuery() method.
    Again, these are two different views, that get different result, based on value of one of the bind variable.
    When I show results in two different tables on jsf page, where master table has "RowSelection" set on "single", all results are displayed in detail table.
    But when I use treeTable, only the first result of the detail is shown.

    I tested it in applicationModule and it works, but i think that's the same as two tables on a jsf page.
    This is the order in which overridden methods are called in ADF BC or two tables on jsf page
    when clicking on row in master table.
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;  -> print of the object2[] parameter in executeQueryForCollection
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313 -> viewLink parameter value
    getEstimatedRowCount_Detail
    count: 2
    getEstimatedRowCount_Detail
    count: 2 And when i click on "expand node" in tree table:
    getEstimatedRowCount_Root
    count: 2
    PrepareRowSetForQuery_Detail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035321
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035313
    PrepareRowSetForQueryDetail
    executeQueryForCollection_Detail user param: 2
       Object 2: class [Ljava.lang.Object;
         List 0: Bind_ChildId -> viewLink parameter
         List 1: 400035321
    getEstimatedRowCount_Root
    count: 2
    getEstimatedRowCount_Root
    count: 2Values of user parameters are OK. Is there another method that i should override?
    I also noticed, that if detail view doesn't have user bind variables, the tree works fine and is shown even in ADF BC (aplication module).
    I guess we loose a tree, when using bind variables in detail view object.
    Is there a way around it?

  • Query with bind variable, how can use it in managed bean ?

    Hi
    I create query with bind variable (BindControlTextValue), this query return description of value that i set in BindControlTextValue variable, how can i use this query in managed bean? I need to set this value in String parameter in managed bean.
    Thanks

    Put the query in a VO and execute it the usual way.
    If you need to, you can write a parameterized method in VOImpl that executes the VO query with the parameter and then call that method from the UI (as a methodAction binding) either through the managed bean or via a direct button click on the page.

  • How to use ApplicationModuleImpl.createViewObject for VO with bind variable

    I need to implement a AM method to create VO instance from a generic VODef with bind variables.
    The createViewObject() will trigger the executeQuery of the VO before I can set up the bind variables for the query.
    What is the proper way to create view object instance with bind variables?

    I am using JDeveloper 11.1.1.2.
    I have a ViewObjectA declared with some bind variables which determine what business data to be retrieved at runtime via a service method of the ApplicationModule.
    As the ViewObjectA is only referenced internally within ApplicationModule and I need more than one instance of the ViewObjectA for different conditions at runtime,
    I use ApplicationModuleImpl.createViewObject() to create an instance of ViewObjectA instead of adding ViewObjectA to the data model of the ApplicationModule.
    Currently, when the ViewObjectA is instantiated, it also trigger an executeQuery() which will not retrieve correct data until I set up the bind variables.
    However, the createViewObject() method doesn't let me pass in the values of the binding variables.
    Currenlty, I just call the createViewObject() and then set the binding variables values and call executeQuery() again.
    Just checking if there is a better way to do so...

  • How to generate text file using spool command

    How can I use a SPOOL command with DBMS_OUTPUT.PUT_LINE with PL/SQL to produce text file on oracle client machine.

    You could try using a REF CURSOR as an alternative. Bare bones example listed below:
    --- SQL Script
    SET FEEDBACK OFF
    COLUMN first_name FORMAT A25
    COLUMN last_name FORMAT A25
    VARIABLE example_data REFCURSOR
    BEGIN
    example.get_data(:example_data);
    END;
    SPOOL example_data.txt
    PRINT example_data
    SPOOL OFF
    -----Output in example_data.txt
    FIRST_NAME LAST_NAME
    First Name 1 Last Name 1
    First Name 2 Last Name 2
    First Name 3 Last Name 3
    First Name 4 Last Name 4
    First Name 5 Last Name 5
    First Name 6 Last Name 6
    First Name 7 Last Name 7
    First Name 8 Last Name 8
    First Name 9 Last Name 9
    First Name 10 Last Name 10
    -----Example package used in SQL Script
    CREATE OR REPLACE PACKAGE example
    IS
    TYPE result_set IS REF CURSOR;
    PROCEDURE get_data
    p_result_set OUT result_set
    END;
    SHOW ERRORS
    CREATE OR REPLACE PACKAGE BODY example
    IS
    PROCEDURE get_data
    p_result_set OUT result_set
    IS
    BEGIN
    -- replace this with your query
    OPEN p_result_set FOR
    WITH fake_data AS (
    SELECT
    'First Name ' || level first_name,
    'Last Name ' || level last_name
    FROM DUAL
    CONNECT BY LEVEL <= 10
    SELECT *
    FROM fake_data
    END;
    END;
    SHOW ERRORS
    SPOOL OFF

  • How to use glob search with the wildcard in command find?

    How to use glob search with the wildcard in command find?
    I want to find any file its names begin with "readme" string using command find. Why the following command cannot work?
    $find /usr/share/doc -name readme*
    However, the following commands can work?
    $find /usr/share/doc -name readme\* or
    $find /usr/share/doc -name readme'*'
    I want to know: After using the “\” or ' ', why the wildcard do not become a character "*"?(still a metacharacter).
    Another question:
    I want to find any file its names begin with "readme*" string using the command find.What command should I use?

    I want to know: After using the “\” or ' ', why the
    wildcard do not become a character "*"?(still a
    metacharacter). The backslash is known as an escape character. It means 'use the character value of the next character, not the special meaning' It is used in a lot of places such as command line, global regular expression patterns, and editors such as vi.
    In a typical shell, the splat (*) expands to all file names before passing the file names to the current command. So a \* sequence tells the shell to pass a *, not a list of file names, to the command.
    Demo - OpenSuSE Linux 10.3
    - I have a bunch of files. Let's list those that end in grid. Create one called *grid, and list again
    pops@fuzzyVM:~/pops> ls 
    a  b  c  startgrid  stopgrid
    pops@fuzzyVM:~> ls *grid
    startgrid  stopgrid
    pops@fuzzyVM:~> ls \*grid
    ls: cannot access *grid: No such file or directory
    pops@fuzzyVM:~> touch '*grid'
    pops@fuzzyVM:~/pops> ls
    a  b  c  *grid  startgrid  stopgrid
    pops@fuzzyVM:~/pops> ls *grid
    *grid  startgrid  stopgrid
    pops@fuzzyVM:~/pops> ls \*grid
    *grid
    pops@fuzzyVM:~/pops>In the above, how would I remove the file *grid, and only that file?
    Another question:
    I want to find any file its names begin with
    "readme*" string using the command find.What command
    should I use?What were the results of the two versions you tried? And why?

  • At CRS-1,how can i use show command with pipe | ?

    HI,ALL
    when I use show command with pipe on the CRS-1,the command invalid
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |errors 
                                                                       ^
    % Invalid input detected at '^' marker.
    ========================================================
    But Previously on the cisco 7609,I can use the show command
    GZ-DM-SR-1.MAN.7609#show int | include line |err
    Vlan1 is down, line protocol is down
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 packets output, 0 bytes, 0 underruns
         0 output errors, 0 interface resets
    Vlan11 is administratively down, line protocol is down
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 packets output, 0 bytes, 0 underruns
         0 output errors, 0 interface resets
    Vlan99 is down, line protocol is down
         0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 packets output, 0 bytes, 0 underruns
         0 output errors, 0 interface resets

    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |errors 
                                                                       ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |?    

    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line | |?
                                                                        ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line | ?
      begin    Begin with the line that matches
      exclude  Exclude lines that match
      file     Save the configuration
      include  Include lines that match
      utility  A set of common unix utilities
      <cr>    
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |
    % Incomplete command.
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |errors
                                                                       ^
    % Invalid input detected at '^' marker.
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#                                     
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line | ?   
      begin    Begin with the line that matches
      exclude  Exclude lines that match
      file     Save the configuration
      include  Include lines that match
      utility  A set of common unix utilities
      <cr>    
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line |?

    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line | include er$
    Thu Jan 15 22:36:24.120 GMT
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#
    RP/0/RP0/CPU0:JA-DL-CR-1.MAN.CRS-1#show interfaces | include line           
    Thu Jan 15 22:37:05.013 GMT
    Loopback0 is up, line protocol is up
    Loopback1 is up, line protocol is up
    Loopback6 is up, line protocol is up
    Null0 is up, line protocol is up
    POS0/0/0/0 is up, line protocol is up  (APS not Configured )
    POS0/0/1/0 is up, line protocol is up  (APS not Configured )
    TenGigE0/0/4/0 is up, line protocol is up

  • Problem with Bind Variable in 11.2

    Hi
    I have a slow statement with bind Variables. With literals it works fine. Is there a way to replace the bind by literal in advanced ? I use Release 11.2.0.2.3
    Thank you

    904062 wrote:
    I have a slow statement with bind Variables. With literals it works fine. Is there a way to replace the bind by literal in advanced ? I use Release 11.2.0.2.3This specific scenario is very much an exception to the rule - and you need to back your statement up with execution plans of the SQL with bind variables and with literals, and run stats that show the difference between these two execution plans.
    See the {message:id=9360003} from the {forum:id=75} forum's FAQ for details on how to post a SQL performance tuning question.

  • LOV(af:selectOneChoice) with bind variable in af:table

    Hi All,
    I have a table where a column is defined as dropdown(af:selectOneChoice). The query for selectOneChoice has a bind variable which needs to be set as a value from the base view Object corresponding row.
    Suppose a table Employee
    EmpId EmpName EmpType Authorization
    101 John Temp No
    The above table is created as af:table and 'Authorization' is implemented as dropdown(af:selectOneChoice) . The selectOneChoice has a query(AuthorizationLovVVO) with bind variable . For each row of af:table(EmployeeVO) , af:selectOneChoice query(AuthorizationLovVVO) requires
    the corresponding row(EmployeeVO) 'EmpType' to be set as value of bind variable.
    Can you please suggest how can we achieve this functionality.
    Edited by: 907302 on Oct 17, 2012 7:22 AM
    Edited by: 907302 on Oct 17, 2012 7:22 AM

    I have checked the following post where it has been suggested to access the the current row value as groovy expression.
    groovy for bind variable
    Suppose my AM name is 'TestAM' , i have tried the below expressions for value of bind variable but it does not work :
    1) adf.object.TestAM.findViewObject('EmployeeVO1').currentRow.EmpType
    2) adf.object.TestAMDataControl.findViewObject('EmployeeVO1').currentRow.EmpType
    None of the above expressions work and i get the error while running the page as 'Variable NotesAM is not recognized.' / 'Variable NotesAMDataControl is not recognized.' .
    Can you please suggest if we can achieve the functionality using this approach . Also let me know if i am missing something in the above expression.

  • SQL query with Bind variable with slower execution plan

    I have a 'normal' sql select-insert statement (not using bind variable) and it yields the following execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=7 Card=1 Bytes=148)
    1 0 HASH JOIN (Cost=7 Card=1 Bytes=148)
    2 1 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=4 Card=1 Bytes=100)
    3 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=3 Card=1)
    4 1 INDEX (FAST FULL SCAN) OF 'TABLEB_IDX_003' (NON-UNIQUE)
    (Cost=2 Card=135 Bytes=6480)
    Statistics
    0 recursive calls
    18 db block gets
    15558 consistent gets
    47 physical reads
    9896 redo size
    423 bytes sent via SQL*Net to client
    1095 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    I have the same query but instead running using bind variable (I test it with both oracle form and SQL*plus), it takes considerably longer with a different execution plan:-
    Execution Plan
    0 INSERT STATEMENT Optimizer=CHOOSE (Cost=407 Card=1 Bytes=148)
    1 0 TABLE ACCESS (BY INDEX ROWID) OF 'TABLEA' (Cost=3 Card=1 Bytes=100)
    2 1 NESTED LOOPS (Cost=407 Card=1 Bytes=148)
    3 2 INDEX (FAST FULL SCAN) OF TABLEB_IDX_003' (NON-UNIQUE) (Cost=2 Card=135 Bytes=6480)
    4 2 INDEX (RANGE SCAN) OF 'TABLEA_IDX_2' (NON-UNIQUE) (Cost=2 Card=1)
    Statistics
    0 recursive calls
    12 db block gets
    3003199 consistent gets
    54 physical reads
    9448 redo size
    423 bytes sent via SQL*Net to client
    1258 bytes received via SQL*Net from client
    3 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    55 rows processed
    TABLEA has around 3million record while TABLEB has 300 records. Is there anyway I can improve the speed of the sql query with bind variable? I have DBA Access to the database
    Regards
    Ivan

    Many thanks for your reply.
    I have run the statistic already for the both tableA and tableB as well all the indexes associated with both table (using dbms_stats, I am on 9i db ) but not the indexed columns.
    for table I use:-
    begin
    dbms_stats.gather_table_stats(ownname=> 'IVAN', tabname=> 'TABLEA', partname=> NULL);
    end;
    for index I use:-
    begin
    dbms_stats.gather_index_stats(ownname=> 'IVAN', indname=> 'TABLEB_IDX_003', partname=> NULL);
    end;
    Is it possible to show me a sample of how to collect statisc for INDEX columns stats?
    regards
    Ivan

Maybe you are looking for

  • How we do set resolutions in javascript to develope a game in unity 3d

    how we do set resolutions in javascript to develope a game in unity 3d

  • Error #1053: Illegal override of frame2

    In Flash CS3, we are creating some components for our authors and designers to use. Because they create many highly-animated movieclips with lots of symbols and components, we initially chose to have AS3 automatically create the stage instance declar

  • Program doesnt run due to classpath issues?

    I am trying to get my Java program to run and it doesnt seem to want to work after it compiles. The two classes (Dog and DogTest) compile but the DogTest wont run and gives me error messages. I have both classes in first directory in the following lo

  • Update attachment file example

    Hi There, Does anybody have an example Livecycle PDF form which allows you to update the contents of an attachment? I'm trying the following code, but nothing seems to be happening (i.e. the file is not updated)...  the doco does not say this is a se

  • Silly basic question please help!

    I composed a web site on iWeb and published via FTP to justhost several months ago. I now have a new MacBook and for the life of me I can't work out how to re-download my website into iWeb so I can make alterations and re-publish it. I'm sure I'm mis