VO with bind variable defined in SQL is not updated correctly

Hi Experts,

I have a simple question here, could you please help answer? Thank you very much!

I have 2 pages, the first page displays an employee table, the second page shows a few details to the selected employee. When to choose a single employee and click the details button I can be naviaged to the second page and see the details for the selected employee. The vo used on the second page uses a connection variable called "empId" thing for a 'adf.context.pageFlowScope.empId' pageFlowScope value, and this value pageFlowScope will be filled to the empId selected detail button actionListener during execution).

The question is, now first navigation is ok, the details of the page can display the correct information for the employee selected on the page of the employee, but when browsing back and choosing another employee, and then again click the details button, the details of the page is NOT updated, it still shows the initial information for the selected employee. I debug the actionListener in support bean and the second selected empId passed to pageFlowScope.empId, the link in the t variable should get the new value, right? But why the second page gets no updates (request using the new value of the bind variable)?

Thank you!

Published by: user774592 on July 20, 2011 23:13

Published by: user774592 on July 20, 2011 23:15

Published by: user774592 on July 20, 2011 23:15

In theory, if you expose specific objects of customer to your business (for example pageflowscope) service layer, you may miss 1. test driven development assistance (case of unit test can fail) 2. Customer service of independent business etc... :)
To respond to your request try to call TargetPagesVO.execute () before the second page (by program or activity method)

Tags: Java

Similar Questions

  • problem with bind variables in the SQL query view object

    Hi all

    I use JDev 11.1.2.4.0.

    I have a problem with bind variables in the SQL query view object.

    This is my original SQL

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE t.nctuser_id = '20022' 
          AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929')
    group by t.legertype_id
    

    In my view .xml object query tab, I am writing this

    SELECT sum(t.TIME) , t.legertype_id
    FROM LEDGER t
    WHERE   t.nctuser_id = '20022'
        AND to_char(t.insertdate,'YYYYMMDD') in :dddd
    group by t.legertype_id
    

    Davis here is a variable of Type liaison: String, updatable and necessary.

    I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.

    But failed. The view object retrieves 0 line after that I run.

    Why?

    Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')

    A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.

    Timo

  • Insert with bind variables

    I will execute bind_test.sql with the following parameters to sql-plus. The script runs without error. However, it does not insert a row in the table.


    bind_test. 20100912 1 1001 SQL;


    bind_test. SQL
    ----------------------------------------------------------
    Set serveroutput on

    declare

    X VARCHAR2 (31);
    NUMBER OF Y;
    NUMBER OF Z;

    Start

    dbms_output. Enable (10000);
    X: = "& 1";
    Y: = & 2;
    Z: = & 3;

    Insert in the test
    values (TO_DATE (X, 'YYYYMMDD'), Y, Z, null, null, null);


    commit;


    dbms_output.put_line ('var1 = "|") X | "var2 =" | THERE | "var3 = ' |" (Z);

    end;
    /

    ----------------------------------
    Output:
    10 old: X: = "& 1";
    10 new: X: = '20100912';
    old 11: Y: = & 2;
    11 new: Y: = 1;
    12 old: Z: = & 3;
    12 News: Z: = 1001;
    var1 = 20100912 var2 = 1 var3 = 1001

    PL/SQL procedure successfully completed.
    ---------------------------------------

    Select * from test;

    no selected line


    Why it is not insert a line? What could be the reason?

    Thanks in advance.
    Amit

    user5922214 wrote:

    I have a big script with multiple INSERT and DELETE statements. I have been asked by DBA to use bind variables rather than direct assignment parameter values in which the condition.

    Impossible.

    Use of variable bind from a client means:
    (1) customer create a unique SQL cursor with bind variable, for example INSERT INTO FOOTABLE VALUES (: 1,: 2: 3)
    (2) customer from a loop of data read
    2.1) reading the customer data (from file, network, device, whatever)
    customer liaison variables 2.2) cursor (assigning values to 1 to 3 SQL cursor variables)
    2.3) client running the cursor
    line insertions 2.4) database
    loop repetitions of 2.5) client for all data
    (3) customer closed the SQL cursor

    This can be done using a SQL script - as a SQL script is not a loop where a single insertion cursor is used. It's a unique script with 100 or 1000 of SQL insert statements. Where each insert statement will result in a cursor SQL must be created.

    SQL * also does not support the approach of customer liaison above variable. It is a command line interface very PRIMITIVE and unsuitable for running scripts from loading/data entry.

    In your case - the right approach would be to have the data into a CSV file, and then load this file using SQL * Loader... where this software will use customer approach above (in fact he still does better because it uses in bulk link and link not row as described above).

  • Get the bind variables name string SQL or the cursor

    Hello

    Is there way to get of the bind variables name string SQL or the cursor?

    Example of
    DECLARE
      l_sql VARCHAR2(2000);
      desctab DBMS_SQL.DESC_TAB;
      curid   PLS_INTEGER;
    BEGIN
    
      l_sql := 'SELECT * FROM emp WHERE mgr = :X and deptno = :Y';
    
      curid := dbms_sql.open_cursor;
      dbms_sql.parse(curid, l_sql, dbms_sql.NATIVE);
      ....
    END;
    What I mean with the SQL string:
    I love to get using some functions from above code variable l_sql all the bind variable.
    In this case the function should return array where is for example: X and: Y

    Back to bind the cursor variable names, I mean same but rather string I pass number of cursor.

    Y at - it sucks ready function or some may share a code customized for this purpose?

    Thanks

    Kind regards
    Jari

    http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Regards,

    Published by: jarola December 19, 2011 02:44

    I found there are wwv_flow_utilities.get_binds of the function not documented in APEX packages that do what I want.
    Usage example
    set serveroutput on
    DECLARE
      binds DBMS_SQL.varchar2_table;
    BEGIN
      binds := wwv_flow_utilities.get_binds('select :P1_TEST from dual');
      FOR i IN 1 .. binds.count
      LOOP
        dbms_output.put_line(binds(i));
      END LOOP;
    END;
    /
    
    anonymous block completed
    :P1_TEST
    But I would not use these functions without papers as those who can change or there is no future versions APEX.
    Is there a documented function or the custom function that do the same thing as wwv_flow_utilities.get_binds?

    Some old basic example code of my friends. Also the media getting the bind variable of PL/SQL code blocks anon.

    SQL> create or replace function GetBindVariables( statement varchar2 ) return TStrings is
      2          --// bind variables names are terminated by one the following special chars
      3          SPECIAL_CHAR    constant TStrings := TStrings(' ',')','+','-','>','<','*',',','=',';',CHR(10),CHR(13));
      4
      5          --// max size of a bind var name
      6          MAX_VARSIZE     constant integer := 100;
      7
      8          pos     integer;
      9          pos1    integer;
     10          occur   integer;
     11          varName varchar2(100);
     12          varList TStrings;
     13  begin
     14          varList := new TStrings();
     15
     16          --// looking for the 1st occurance of a bind variable
     17          occur := 1;
     18
     19          loop
     20                  pos := InStr( statement, ':', 1, occur );
     21                  exit when pos = 0;
     22
     23                  varName := SubStr( statement, pos, 100 );
     24
     25                  --// find the terminating char trailing the
     26                  --// bind variable name
     27                  pos1 := Length( varName );
     28                  for i in 1..SPECIAL_CHAR.Count
     29                  loop
     30                          pos := InStr( varName, SPECIAL_CHAR(i) ) - 1;
     31                          if (pos > 0) and (pos < pos1) then
     32                                  pos1 := pos;
     33                          end if;
     34                  end loop;
     35
     36                  --// extract the actual bind var name (without
     37                  --// colon char prefix)
     38                  varName := SubStr( varName, 2, pos1-1 );
     39
     40                  --// maintain a unique list of var names
     41                  if not varName member of varList then
     42                          varList.Extend(1);
     43                          varList( varList.Count ) := varName;
     44                  end if;
     45
     46                  --// look for the next occurance
     47                  occur := occur + 1;
     48          end loop;
     49
     50          return( varList );
     51  end;
     52  /
    
    Function created.
    
    SQL>
    SQL> select
      2          column_value as BIND_VAR
      3  from TABLE(
      4          GetBindVariables('select * from foo where col=:BIND1 and day = to_date(:B2,''yyyy/mm/dd'')')
      5  );
    
    BIND_VAR
    ------------------------------
    BIND1
    B2
    
    SQL> 
    

    PS. just realize this code is case-sensitive, while variable bind is not. Should throw a upper() or lower() by adding the name of the var to the list - never really a problem for me because I'm pretty tense when it use cases correctly in the code. ;-)

    Published by: Billy Verreynne, December 19, 2011 06:19

  • Problems with Bind Variables

    SELECT co.ref_num, co.forename, co.surname, co.dob, a.address, a.postcode,
           co.ni_num
      FROM address a, contact co
     WHERE co.ref_num = a.ref_num
       AND (:1 IS NULL OR co.forename = :2)
       AND (:3 IS NULL OR co.surname = :4)
       AND (:5 IS NULL OR a.postcode = :6)
       AND (:7 IS NULL OR a.address = :8)
       AND (:9 IS NULL OR co.dob = :10)
       AND (:11 IS NULL OR co.ni_num = :12)
    With a jdbc connection, we use a web front end for a new management system. The SQL above runs since a search screen. We meet a few serious problems with bind variable and execution plans. When the above query is sent by the database 'AND' clauses could evaluate as follows:
    AND ('Tim' IS NULL OR co.forename = 'Tim')
       AND ('Clarke' IS NULL OR co.surname = 'Clarke')
       AND ('' IS NULL OR a.postcode = '')
       AND ('' IS NULL OR a.address = '')
       AND ('25051981' IS NULL OR co.dob = '25051981')
       AND ('' IS NULL OR co.ni_num = '')
    We cannot dynamically assign 'AND' conditions so they are sent through to the database. This translates FTS 99% of the time as the execution plan never prescribed any of the available indices.

    Someone has suggestions on how to better 'control' bind variables?

    Hello

    Don't you think that 'OR' Conditions are necessary to check for Null, where the binding variable is NULL or not.

    I think that rather than running the query from the front to FB, try to convey the values of some MS and run this query in the procedure, the extraction from the point of view Design coding application. Never fire the query of the frontal part.

    To come to the problem.

    SELECT co.ref_num, co.forename, co.surname, co.dob, a.address, a.postcode,
    Co.ni_num
    ADDRESS, contact co
    WHERE co.ref_num = a.ref_num
    AND (: 1 co.forename IS NULL or =: 2)
    AND (: 3 co.surname IS NULL or =: 4)
    AND (: 5 a.postcode IS NULL or =: 6)
    AND (: 7 a.address IS NULL or =: 8)
    AND (: 9 co.dob IS NULL or =: 10)
    AND (: 11 co.ni_num IS NULL or =: 12)

    Use the procedure.

    Fact exits of the indexes on the tables and stats are updated...?
    Try to predict explain it. ??

    -Pavan Kumar N

  • R12 Extension with bind variables-how VO EO

    Hello

    I extended an APInvDistAllVO view object by adding two fields which are functions. Basically, in the invoice approval screen, I want to add two fields where the distribution of the invoice is shown.

    the SQL contained in jdeveloper when you extend the VO object is different from the query, what I see in the invoice approval page by clicking on the APInvDistAllVO link. There are two bind variable: 1 = invoice_id and: 2 = line_number being added dynamically.

    After the extension of the view object, the invoice distribution line is displayed as no record found. In my opinion, it is due to not having bind variables does not correct parameters being passed, and under this point of view object is an object depending on the invoice header record.

    Will be very grateful if someone can provide the way forward in dealing with this situation.

    Rgds

    Fahad

    User, please ask your question in the forum OA Framework .

    Timo

  • EO base extension VO with bind variables and display - How To link

    Hello

    I extended an APInvDistAllVO view object by adding two fields which are functions. Basically, in the invoice approval screen, I want to add two fields where the distribution of the invoice is shown.

    The SQL contained in jdeveloper when you extend the VO object is different from the query, what I see in the invoice approval page by clicking on the APInvDistAllVO link. There are two bind variable: 1 = invoice_id and: 2 = line_number being added dynamically. After the extension of the view object, the invoice distribution line is displayed as no record found.

    In my opinion, it is due to not having bind variables does not correct parameters being passed, and under this point of view object is an object depending on the invoice header record. There is a link to the original View object as well. Will be very grateful if someone can provide the way forward in dealing with this situation.

    Rgds Fahad

    Hi AJ

    He worked after changing the style of bind.

    Thank you very much.

    Rgds

    Fahad

  • Problem with Bind variable cannot be changed.

    Hi all
    I use Jdev 11.1.2.3.0. In my VO, I created a Bind Variable and set it NOT UPDATABLE. Then, I created a display with some other Variables Bind criterion.
    I use this criterion to display on a search page, but when running, I see also an inpunt for the defined variable NOT UPDATABLE text and I can't change its value.
    Of course, if I try to change the value, and I do research, I get an error.

    It is the source of the VO:

    < variable
    Name = "UlssVar".
    Type = "where".
    Type = "Java.lang.String"
    IsUpdateable = "false" >
    < TransientExpression > <! [CDATA [adf.context.current.sessionScope.get ('ulss')]] > < / TransientExpression >
    < / variable >

    Is this a bug of the ADF?
    I thank in advance.

    Hello

    try selecting the variable binding and open the property inspector, under the guidance of the user interface, set the flag of 'view' to hide. This should hide it (no bug for this reason)

    Frank

  • Create the collection of query with bind variable

    Apex 4.0.2

    By Joel Re: Collection with variable binding the apex_collection.create_collection_from_query_b supports queries containing references to the bind variables (: P1_X) but I don't know how to use this feature, the documentation is not an example, just the API signature for the overloaded version has changed.

    If the query contains 2 bind session state variable references (: P1_X and: P1_Y), can someone please show an example of what to spend for the parameters p_names and p_values to the API?

    Thank you
    procedure create_collection_from_query_b(
        --
        -- Create a named collection from the supplied query using bulk operations.  The query will
        -- be parsed as the application owner.  If a collection exists with the same name for the current
        -- user in the same session for the current Flow ID, an application error will be raised.
        --
        -- This procedure uses bulk dynamic SQL to perform the fetch and insert operations into the named
        -- collection.  Two limitations are imposed by this procedure:
        --
        --   1) The MD5 checksum for the member data will not be computed
        --   2) No column value in query p_query can exceed 2,000 bytes
        --
        --
        -- Arguments:
        --     p_collection_name   =  Name of collection.  Maximum length can be
        --                            255 bytes.  Note that collection_names are case-insensitive,
        --                            as the collection name will be converted to upper case
        --     p_query             =  Query to be executed which will populate the members of the
        --                            collection.  If p_query is numeric, it is assumed to be
        --                            a DBMS_SQL cursor.
        -- example(s):
        --     l_query := 'select make, model, caliber from firearms';
        --     apex_collection.create_collection_from_query_b( p_collection_name => 'Firearm', p_query => l_query );
        --
        p_collection_name in varchar2,
        p_query           in varchar2,
        p_names           in wwv_flow_global.vc_arr2,
        p_values          in wwv_flow_global.vc_arr2,
        p_max_row_count   in number default null)
        ;

    HELEN wrote:
    Apex 4.0.2

    By Joel Re: Collection with variable binding the apex_collection.create_collection_from_query_b supports queries containing references to the bind variables (: P1_X) but I don't know how to use this feature, the documentation is not an example, just the API signature for the overloaded version has changed.

    If the query contains 2 bind session state variable references (: P1_X and: P1_Y), can someone please show an example of what to spend for the parameters p_names and p_values to the API?

    Not tried, but guess something like

    apex_collection.create_collection_from_query_b(
        p_collection_name => 'foobar'
      , p_query => 'select f.foo_id, b.bar_id, b.baz from foo f, bar b where f.foo_id = b.foo_id and f.x = to_number(:p1_x) and b.y = :p1_y'
      , p_names => apex_util.string_to_table('p1_x:p1_y')
      , p_values => apex_util.string_to_table(v('p1_x') || ':' || v('p1_y')))
    
  • bind variables in pl/sql static

    Hello world.
    This feature will be works faster than the function below without binding? (I mean if he calls very often, and execution plan is in cache)
    FUNCTION get_amployee_name (empid INTEGER, empcity VARCHAR2) RETURN VARCHAR2 IS
        TYPE GenericCursor IS REF CURSOR;
        c1 GenericCursor;
        empname VARCHAR2(200);
    BEGIN
        OPEN c1 FOR SELECT ename FROM employees WHERE id = :id AND city = :city USING empid, empcity;
            FETCH c1 INTO empname;
        CLOSE c1;
        RETURN empname;
    END;
    FUNCTION get_amployee_name (empid INTEGER, empcity VARCHAR2) RETURN VARCHAR2 IS
        empname VARCHAR2(200);
    BEGIN
        SELECT ename into empname  FROM employees WHERE id = empid  AND city = empcity;
        RETURN empname;
    END;
    I tried to find info related to the execution of pl/sql query steps, but cannot. Optimizer does use the values of real variables in pl/sql to generate the exec. plan? Or it will be generated only once when the function performed the first time?

    Reference and discusses this in Chapter 1 PL/SQL user's Guide

    http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/overview.htm#sthref145

    "When you embed an INSERT, UPDATE, DELETE or SELECT SQL statement directly in your PL/SQL code, PL/SQL transforms the variables in the WHERE clauses of the VALUES to automatically bind variables. Oracle can re-use these SQL statement every time the same code is executed. To execute statements similar with different values of variables, you can save the analysis of overhead by calling a stored procedure that accepts parameters, and then issues the declarations with the parameters substituted in the appropriate places. »

    Justin

  • IN construction in the clause WHERE of VO with bind variable

    Hello
    With the help of JDev 11.1.1.3.0.
    I have a SQL according to VO following where clause ' WHERE some_nbr IN: inSomeNbrStr'
    -l' some_nbr attribute is of type oracle.jbo.domain.Number.
    -variable binding inSomeNbrStr is of type String.
    I'm assuming that this variable linking parameter to for example. "101, 102' or '(101, 102) ' before the execution of the query might work.
    "However, I get ' ORA-01722: invalid number." Other than the substitution of executeQueryForCollection() and manipulate by program the
    query is - anyone know a more declarative way to achieve this?
    Thank you
    Kenneth

    Hello

    You "MOUNT" the binding variable to get the values separated by commas.

    See this article (Search Using Comma-Separated bind string for the Variable in the list) on how to achieve this.

    It has been developed over 10g. But I think it will hold good for 11g as well.

    Arun-

  • Collection with bind variable

    Hi all
    It could be more a matter of sql pl but I am trying to create a collection in the apex where the query uses a connection variable. I can't get this application to work.

    It works

    p_query = > 'select je_batch_id in the gl_je_batches where default_period_name = "MAY-10" ',

    but I can't make it work with a variable binding.

    p_query = > ' select je_batch_id in the gl_je_batches where default_period_name =: P14_EPSB_ARGYLL_PERIODS: ',

    any help would be greatly appreciated.
    Thank you

    Hello

    Try

    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY_B(
     p_collection_name => 'MY_COLLECTION',
     p_query => 'select je_batch_id from gl_je_batches where default_period_name = v(''P14_EPSB_ARGYLL_PERIODS'')'
    );
    

    BR, Jari

  • by the way a Bind Variable in a sql file

    Hi all

    I have a sql file in which a variable binding is defined as follows:

    The variable var number;
    Start
    : var: = & Give_value_for_var;
    end;
    /

    then I'm calling an another sql fine within this file and passing var as an argument to this file as below:

    @another_sql_file.sql: var;

    The above doesn't seem to work. Could you please let me know the correct way to pass this?

    Thanks in advance.

    Edited by: Ash_ December 4, 2009 05:09

    You mean something like: -.

    variable var number;
    begin
    :var := &&Give_value_for_var;
    end;
    /
    
    @another_sql_file.sql &&Give_value_for_var
    
  • Estimates of cardinality for index range scan with bind variables

    Oracle 11.2.0.4

    I am struggling to explain that the cardinality estimates for a scan of the index systematic range when using the bind variable.

    Consider the following query:

    SELECT /*+ INDEX(t1) */ *
    FROM   t1
    WHERE  source_id <= ?;
    
    

    Cardinalities for the INDEX RANGE SCAN and ACCESS of the TABLE are the same for different literal predicates, for example, source_id < = 5:

    ------------------------------------------------------------------------------------
    | Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |      |    50 |   350 |    12   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1   |    50 |   350 |    12   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IX1  |    50 |       |     2   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("SOURCE_ID"<=5)
    
    

    If a variable binding is used instead of a literal, the overall selectivity is 5%. However, why the optimizer based on CSSTidy gives a cardinality estimated 11 for the scan of the index systematic range? As with the predicates literal, surely the cardinalities of the index range scan and access table should be the same?

    ------------------------------------------------------------------------------------
    | Id  | Operation                   | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |      |    50 |   350 |     5   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1   |    50 |   350 |     5   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | IX1  |    11 |       |     2   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("SOURCE_ID"<=TO_NUMBER(:A))
    
    

    Unit test code:

    CREATE TABLE t1
    ( id NUMBER
    , source_id NUMBER
    );
    
    CREATE INDEX ix1 ON t1 (source_id);
    
    INSERT INTO t1
    SELECT level
         , ora_hash(level,99)+1
    FROM   dual
    CONNECT BY level <= 1000;
    
    exec DBMS_STATS.GATHER_TABLE_STATS(user,'T1')
    
    EXPLAIN PLAN FOR
    SELECT /*+ INDEX(t1) */ *
    FROM   t1
    WHERE  source_id <= 5;
    SELECT * FROM TABLE(dbms_xplan.display);
    
    EXPLAIN PLAN FOR
    SELECT /*+ INDEX(t1) */ *
    FROM   t1
    WHERE  source_id <= :a;
    SELECT * FROM TABLE(dbms_xplan.display);
    
    

    There are various places where the optimizer uses an assumption, and lie unpeekable (and of Villa "unknowable value") introduced guess.

    For unpeekable binds the conjecture for column<= {unknown}="" is="" 5%="" for="" table="" access="" (hence="" 50="" rows="" out="" of="" 1,000),="" but="" it's="" 0.009="" for="" index_column=""><= {unknown},="" which="" means="" i="" was="" expecting="" to="" see="" 9="" as="" the="" row="" estimate="" on="" the="" index="" range="">

    I just ran some quick tests, and EXPLAIN the PLAN seems to just use 0.011 selectivity in this case (in different versions of Oracle) although if we do the bind variable unpeekable at run time (and sample dynamic block etc.) optimization for execution is 0.009%.

    Concerning

    Jonathan Lewis

    Update: and this is a very old reference to the 0.009 (and 0.0045 for ' between the ' when it is applied to a clue: cost based Oracle - access Chapter 4 single B-tree )

  • How to use the command the reel with Bind Variables

    For the next REEL, I want the GEN_DATE to be entered by the user at the time of execution of the SQL Script. Is this possible in the command of the COIL.


    the colsep value,-separate the columns with a comma
    set pagesize 1000 - get rid of disturbing - between pages
    set position-the title of column Print
    Set trimspool on - remove the spaces to the right. eliminating spaces until eol
    set linesize 700 - line size should be the sum of the column width
    coil spool_results.csv
    SELECT *.
    OF 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 opportunity to the user so that he can enter any beach without changing the code of the script.

    Can someone help me please.

    Published by: user10903866 on February 18, 2013 19:44

    Hello

    user10903866 wrote:
    For the next REEL, I want the GEN_DATE to be entered by the user at the time of execution of the SQL Script. Is this possible in the command of the COIL.

    Do you want user input in the command of the COIL, or want you she in the query?

    the colsep value,-separate the columns with a comma
    set pagesize 1000 - get rid of disturbing - between pages
    set position-the title of column Print
    Set trimspool on - remove the spaces to the right. eliminating spaces until eol
    set linesize 700 - line size should be the sum of the column width
    coil spool_results.csv
    SELECT *.
    OF 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 are the data type gen_date of the oif?
    If it is a string, it is a big mistake. Information about the dates in the DATE columns belongs.
    If it's a DATE, so don't try to compare strings, such as "2012-11-01 00:00:00:00000'."

    spool off;

    The reason is to give the opportunity to the user so that he can enter any beach without changing the code of the script.

    Can someone 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  OFF
    

    There are security considerations. Variables substitution to the devious users the power to issue a SQL, such as DROP TABLE command. Users with SQL * Plus access already have this power, anyway.

Maybe you are looking for