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

Tags: Database

Similar Questions

  • 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

  • Ensure this soft analysis the use of Bind variables

    Hi Experts,

    I have a request when the query is prepared dynamically in Java code and if I take the query and run it from SQL Navigator, it takes a long time to prepare the statement and then execute it quickly. I think we can use dynamic SQL statements and bind variable to improve performance here. However, I tried to do a PDS to check my understanding. I created 2 procedures

    1. mode of operation
    CREATE OR REPLACE PROCEDURE sp_static
    (id IN NUMBER, 
     name in VARCHAR2)
    IS 
    TYPE r_curs_type is REF CURSOR;
    C1 r_curs_type;
    BEGIN
    
    OPEN C1
    FOR
    SELECT * FROM TABLE WHERE columname = id
    
    CLOSE C1;
    
    END;
    2. mode of operation
    CREATE PROCEDURE sp_dyanmic
    (id IN NUMBER, 
     name in VARCHAR2)
    IS 
    TYPE r_curs_type is REF CURSOR;
    C1 r_curs_type;
    BEGIN
    
    OPEN C1 FOR 'SELECT * FROM TABLE WHERE columnanme = :U1' 
    USING ID;
    
    CLOSE C1;
    END;
    To my amazement, there is no difference in the duration of execution of these procedures when I ran the with multiple entries.

    Please note-
    1. I have not access to trace files :-(
    2. I want to just make sure there will be improved performance before starting the real work, given that some efforts provided by moving the logic of all its activities inside and the use of bind variables.

    If you can suggest a strategy to ensure performance gains, it will be extremely useful...

    Thanks in advance!
    Concerning

    Hello

    (1) it's true, procedure 1 also uses a variable binding
    (2) you seem to be confused about the very basic concepts here

    Dynamic SQL is something like this:

    create or replace FUNCTION f (l_table_name VARCHAR2) RETURN NUMBER
    IS
      l_result NUMBER;
    BEGIN
      EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || l_table_name  INTO l_result;
      return l_result;
    END;
    

    In this example, since you do not know the name of the table to the execution table, everything you can
    is dynamic SQL. As you can see, neither of your two procedures is like that.

    Dynamic SQL is used when you do not know what columns you want to select, or who
    etc. to the execution table. You can also use dynamic SQL statements to force analysis. You can not use
    to avoid parsing, binding or not binding.

    Best regards
    Nikolai

  • 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

  • I filled out a form on the page 8 and he saved several times along the way, and now when I open this file, the form is empty?  How can I save my work so I can open the form later and it contains all my data?

    I filled out a form on the page 8 and he saved several times along the way, and now when I open this file, the form is empty?  How can I save my work so I can open the form later and it contains all my data?

    Hi Eileen97933052,

    The PDF form must be extended drive in order to have this feature to save & print the form data.

    Please confirm by the PDF Creator is the PDF reader or not extended.

    Otherwise, if you have Acrobat installed on your system, you can reader extend PDF form yourself.

    Kind regards

    Nicos

  • The use of bind variables (in &amp; out) with sql dynamic

    I have a table that contains code snippets to make postings on a set of pl/sql database. what the code does is basically receives an ID and returns a number of errors found.
    To run the code, I use dynamic sql with two bind variables.

    When codes consists of a simpel query, it works like a charm, for example with this code:
    BEGIN
       SELECT COUNT (1)
       INTO :1
       FROM articles atl
       WHERE ATL.CSE_ID = :2 AND cgp_id IS NULL;
    END;
    However when I get to post more complexes that must perform calculations or run several queries I run into trouble.
    I have boiled down the problem into that:
    DECLARE
       counter   NUMBER;
       my_id     NUMBER := 61;
    BEGIN
       EXECUTE IMMEDIATE ('
          declare 
             some_var number;
          begin
          
          select 1 into some_var from dual
          where :2 = 61; 
          
          :1 := :2;
          end;
    ')
          USING OUT counter, IN my_id;
    
       DBMS_OUTPUT.put_line (counter || '-' || my_id);
    END;
    This code is not really make sense, but it's just to show you what is the problem. When I run this code, I get the error
    ORA-6537 ON bind variable linked to a position IN

    The error doesn't seem wise,: 2 is the only one IN bind variable and it is only used in a where clause clause.
    As soon as I remove this where clause, the code works again (giving me 61-61, in case you want to know).

    Any idea what goes wrong? I just use bind variables in a way that you're not supposed to use it?

    I'm using Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit

    Correction. With immediate execution , the binding is in position, but binds do not need to be repeated. My statement above is incorrect...

    You must link only once - but bind by position. And the connection must correspond to the use of the variable binding.

    If the connection never variable assigns a value in the code, link by in.

    If the binding variable assigns a value in the code, link as OUTPUT.

    If the binding variable assigns a value and is used a variable in another statement in the code, link as IN OUT.

    For example

    SQL> create or replace procedure FooProc is
      2          cnt     number;
      3          id      number := 61;
      4  begin
      5          execute immediate
      6  'declare
      7          n       number;
      8  begin
      9          select
     10                  1 into n
     11          from dual
     12          where :var1 = 61;       --// var1 is used as IN
     13
     14          :var2 := n * :var1;     --// var2 is used as OUT and var1 as IN
     15          :var2 := -1 * :var2;    --// var2 is used as OUT and IN
     16  end;
     17  '
     18          using
     19                  in out id, in out cnt;  --// must reflect usage above
     20
     21          DBMS_OUTPUT.put_line ( 'cnt='||cnt || ' id=' || id);
     22  end;
     23  /
    
    Procedure created.
    
    SQL>
    SQL> exec FooProc
    cnt=-61 id=61
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • The use of bind variables in dynamic query created for Ref Cursor

    Hello

    I'm in a situation where there is a Ref cursor to which the query is built execution based on a loop. This is why the number of links would be known until the program runs.
    The application is currently using literals instead of bind variables.

    code snippet of the above is
    strSql: = "select * from emp where 1 = 1 and ().

    loop cursor1
    If cond is true then
    strSql = strSql | "ename = ' |" Cursor1.ColumnName;
    end loop;

    Open cursor2 for strSql;

    How to use links in the example above.

    sb92075 wrote:

    user13019948 wrote:
    Hello

    Here is the code I have my trying to change literal-based link to the base.

    What do you mean by "based bind?

    who, what, how determines the values to be 'bound '?

    He's referring to the coding style. He is currently using concatenated literal, and the goal is to change it to use the bindings.

    If I understand this it is known as method 4 dynamic SQL and requires DBMS_SQL. There are examples autour but they vary according to the type of statement being generated - SELECT statements require column lists to be parsed, unlike the INSERT/UPDATE/DELETE.

    This came up recently on my current project and I hit a demo. Here a table of names and values accepted procedure and had to build these in a single WHERE clause along the lines of

    AND t_names(i) = t_values(i)
    

    for an undetermined number of elements in the array. For this demonstration, I used a table that we called "attribute" (don't ask) which has columns including 'attribute_id' and 'name', and I need to build a query along the lines of

    select description from attribute where attribute_id = :b1 and name = :b2
    

    by the way '1012' and 'ISIN' respectively. (I use a table better and after a CREATE statement for her but I have to rush right now, sorry).

    declare
       k_sql_base        constant varchar2(500) := 'select description from attribute';
    
       t_names           constant varchar2_t := varchar2_t('attribute_id',  'name');
       t_values          constant varchar2_t := varchar2_t('1012',          'ISIN');
    
       l_sql             varchar2(500) := k_sql_base;
       l_rows_fetched    integer := 0;
       l_value           varchar2(4000);
    
       l_cursor_handle   integer;
    
    begin
       -- Construct the SQL statement with column names and bind variables e.g.
       -- 'select description from mars.attribute where attribute_id = :b1 and name = :b2'
       for i in t_names.first .. t_names.last loop
          l_sql := l_sql ||
             case i
                when t_names.first then ' where ' else ' and '
             end ||
             t_names(i) || ' = :b' || i;
       end loop;
    
       dbms_output.put_line('SQL statment = ' || l_sql); 
    
       -- Parse the statement we built above (the remaining steps require a parsed cursor):
       l_cursor_handle := dbms_sql.open_cursor;
       dbms_sql.parse(l_cursor_handle, l_sql, dbms_sql.native);
    
       -- Associate the 1st column of output with variable l_value - required for SELECT statements:
       -- (actually the 3rd param here 'column' seems to be only used to get a datatype, in this case we want a string -
       -- dbms_sql.column_value actually extracts the value into a specified variable, which can be different.
       -- All examples in the documentation pass a local variable without further comment, so not entirely clear what this does other than set the output datatype.)
       dbms_sql.define_column(l_cursor_handle, 1, l_value, 4000);
    
       -- Now go through values array binding actual values to :bn variables in the cursor (similar to USING clause of EXECUTE IMMEDIATE)
       for i in t_values.first .. t_values.last loop
          dbms_sql.bind_variable(l_cursor_handle, ':b'||i, t_values(i));
          dbms_output.put_line('Bound :b'||i || ' as ' || t_values(i));
       end loop;
    
       -- Open the cursor and fetch the result (no loop here because we are expecting a single-row result):
       l_rows_fetched := dbms_sql.execute_and_fetch(l_cursor_handle);
    
       -- 'Returns value of the cursor element for a given position in a cursor'
       -- Copy the value of column 1 to variable l_value (has to match
       -- dbms_sql.column_value(l_cursor_handle, 1, l_value);
       dbms_sql.column_value(l_cursor_handle, 1, l_value);
    
       dbms_output.put_line('Result = ''' || l_value || '''');
    
       dbms_sql.close_cursor(l_cursor_handle);
    end;
    

    Hope that helps...

  • The use of bind variables with XMLTABLE?

    I tried to use bind variables with xmltable statement. Here, my unit test:

    create or replace function wsdltest return xmltype as
    l_dummy xmltype.
    CLOB l_stt;
    L_Name varchar2 (500);
    CLOB l_xml;
    BEGIN
    l_xml: =.
    ' < name of definitions = 'F1' targetNamespace = "http://xmlns.oracle.com/orawsv/XFILES/F1" xmlns = "http://schemas.xmlsoap.org/wsdl/" xmlns:tns = "http://xmlns.oracle.com/orawsv/XFILES/F1" container = "http://www.w3.org/2001/XMLSchema" xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/" >
    < types >
    < xsd: Schema targetNamespace = "http://xmlns.oracle.com/orawsv/XFILES/F1" elementFormDefault = "qualified" >
    < xsd: element name = "SVARCHAR2-F1Input" >
    < xsd: complexType >
    < xsd: SEQUENCE >
    < xsd: element name = "A VARCHAR2 IN" type = "xsd: String" / >
    < / xsd: SEQUENCE >
    < / xsd: complexType >
    < / xsd: element >
    < xsd: element name = "F1Output" >
    < xsd: complexType >
    < xsd: SEQUENCE >
    < xsd: element name = "RETURN" type = "xsd: String" / >
    < / xsd: SEQUENCE >
    < / xsd: complexType >
    < / xsd: element >
    < / xsd: Schema >
    < / types >
    < name of message = "F1InputMessage" >
    < name of part = "parameters" element = "tns:SVARCHAR2 - F1Input" / >
    < / message >
    < name of message = "F1OutputMessage" >
    < name of part = "parameters" element = "tns:F1Output" / >
    < / message >
    < portType name = "F1PortType" >
    < operation name = "F1" >
    < input message = "tns:F1InputMessage" / >
    < output message = "tns:F1OutputMessage" / >
    < / operation >
    < / portType >
    < connection name = "F1Binding" type = "tns:F1PortType" >
    < style: binding soap = transport "document" = "http://schemas.xmlsoap.org/soap/http" / >
    < operation name = "F1" >
    < soap: operation soapAction = "F1" / >
    < input >
    < soap body parts: = 'settings' use = "literal" / >
    < / Entry >
    < output >
    < soap body parts: = 'settings' use = "literal" / >
    < / output >
    < / operation >
    < / binding >
    < service name = "F1Service" >
    < documentation > Oracle Web Service < / documentation >
    < name of port = "F1Port" binding = "tns:F1Binding" >
    < soap: address location = "http://localhost: 8080/orawsv/XFILES/F1" / >
    < / port >
    < / service >
    < / definitions > ';

    -OK
    l_stt: = ' select * from xmltable (XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema" AS "XSD", default "http://schemas.xmlsoap.org/wsdl/"),)
    [' / / definitions/types/XSD:schema/XSD:element[@name="SVARCHAR2-F1Input ']"
    by the way xmltype(:1)
    columns
    path of xmltype AB ".") you;
    --
    EXECUTE IMMEDIATE l_stt INTO l_dummy using l_xml;

    -ERROR ORA-01006
    L_Name: = ' 'SVARCHAR2-F1Input "";
    l_stt: = ' select * from xmltable (XMLNAMESPACES ("http://www.w3.org/2001/XMLSchema" AS "XSD", default "http://schemas.xmlsoap.org/wsdl/"),)
    [/ / definitions/types/XSD:schema/XSD:element[@name=:2] "
    by the way xmltype(:1)
    columns
    path of xmltype AB ".") you;
    --
    EXECUTE IMMEDIATE l_stt INTO l_dummy using l_xml, l_name;

    Return l_dummy;
    END;

    Any idea?

    Thanks in advance
    Cyryl

    You can try something like

    declare
      l_dummy xmltype;
      l_stt clob;
      l_name varchar2(500);
      l_xml clob;
    BEGIN
    l_xml :=
    '
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    Oracle Web Service
    
    
    
    
    ';
    l_stt := q'~ select *
      from xmltable( XMLNAMESPACES( 'http://www.w3.org/2001/XMLSchema' AS "XSD", default 'http://schemas.xmlsoap.org/wsdl/'),
                   '/definitions/types/XSD:schema/XSD:element'
                   passing xmltype( :2 )
                   columns
                   ab xmltype path '.' ) t
         where extractvalue( ab, '/element/@name', 'xmlns="http://www.w3.org/2001/XMLSchema"' ) = :1
     ~';
    l_name := 'SVARCHAR2-F1Input';
      EXECUTE IMMEDIATE to_char( l_stt ) INTO l_dummy using l_xml, l_name;
      dbms_output.put_line( l_dummy.getstringval() );
    end;
    /
    
  • Getting the error for bind variables

    Hello Experts;

    SQL > DECLARE

    2 l_eid number;

    3 l_name varchar2 (30);

    4 BEGIN

    l_eid 5: = 1000;

    6 select name from l_name tab1 where it = l_eid;

    7 l_eid: = 9999;

    8 select name from l_name tab1 where it = l_eid;

    9 l_eid: = 299999.

    10 select name from l_name tab1 where it = l_eid;

    11 * END;

    /

    PL/SQL procedure successfully completed.

    When you create variable bind I get the error message:

    SQL > variable number b1;

    SQL > exec: b1: ='select name from which no = tab1: b1';

    START: b1: ='select name from which no = tab1: b1'; END;

    * ERROR at line 1:

    ORA-06502: PL/SQL: digital or value error: character of number conversion error

    ORA-06512: at line 1

    If you want to use variable bind you:

    number variable b1

    VARCHAR2 (30) variable b2

    exec: b1: = 1000;

    Start

    Select name

    in: b2

    of tab1

    where = none: b1;

    end;

    /

    print: b2

    For example:

    SQL > variable b1 number
    SQL > b2 variable varchar2 (30)
    SQL > exec: b1: = 7839;

    PL/SQL procedure successfully completed.

    SQL > start
    2. Select ename
    3 in: b2
    4 of PEM
    5 where empno =: b1;
    6 end;
    7.

    PL/SQL procedure successfully completed.

    SQL > print: b2

    B2
    --------------------------------
    KING

    SQL >

    SY.

  • trace of the user with bind variables

    Hi all

    10.2.0.4 on solaris 10

    Followed a user session, once the connection to the database, using the below
    create or replace trigger login_trigger 
    after logon on database 
      begin 
         if (USER in ('MED','MEDT')) then 
    execute immediate 
        'ALTER SESSION SET EVENTS ''10046 TRACE NAME CONTEXT FOREVER, LEVEL 4'''; 
         end if; 
      end; 
    /  
    I understand that the level 4 will be the value of the variables bind inside... but isn't the generated trace file
    the value of the variable bind as you can see below

    PARSE ERROR #7:len=261 dep=0 uid=196 oct=3 lid=196 tim=12004802132819 err=907
    select :"SYS_B_0"  from ORM_RESTRICTED_CAT_BAL_ORD where (((CONTRACT_CAT=:b0 and ORDER_NO=:b1) and PREPOST_PAID in (:b2:b3,:"SYS_B_1")) and ((TRUNC(SYSDATE)>=
    TRUNC(FROM_DATE) and TO_DATE is null ) or TRUNC(SYSDATE) between TRUNC(FROM_DATE) and TRUNC(TO_DATE)))
    Am I missing something?

    KaiS wrote:
    =====================
    PARSE ERROR #7:len = 261 dep = 0 = 95 oct cover 3 = uid = 95 tim = 12005421332712 err = 907
    Select: 'SYS_B_0' from ORM_RESTRICTED_CAT_BAL_ORD where (((CONTRACT_CAT =: b0 et ORDER_NO =: b1) and PREPOST_PAID in (: b2:b3,: 'SYS_B_1')) and ((TRUNC (SYSDATE) > =)))
    TRUNC (from_date) and TO_DATE is null) or trunc (sysdate) between TRUNC (FROM_DATE) and TRUNC (TO_DATE)))

    Looks like you got a parse error. You got yet to the phase of binding of variables again so I don't expect to see in the trace file.

  • The use of bind variables in the application process

    Bind variables refer to elements of session state supported in queries in an application request process?

    All the examples I see show how to pass client side values using the $v () function and the htmldb_get object addParam method and refer to them using the wwv_flow.g_xNN variables, but already available in session state values, I should be able to use them directly in the process, right?

    Thank you

    Yes, they are supported.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • By the way and form Variables collection

    Let's say it's for my form code:

    < html >
    < head >
    < script type = "text/javascript" >
    function formSubmit()
    {
    document.getElementById("myForm").submit)
    }
    < /script >
    < / head >

    < body >
    < p > enter text in the fields of text below and press the "Send" button to submit the form. < /p >

    < form id = "myForm" action = "js_form_action.asp" method = "get" > "
    First name: < input type = "text" name = "FirstName" size = "20" > < br / >
    LastName: < input type = "text" name = "lastname" size = "20" > < br / >
    < br / >
    < input type = "button" onclick = "formSubmit ()" value = "Submit" > "
    < / make >
    < / body >

    < / html >

    Now, let's say I want to take the first name and the last name of variables and their gathering in another form (i.e.) passing variables from one form to the other. How can I do this?

    I thought about it using coldfusion. on the following form I just use FORM. #fieldname #. Thank you.

  • 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)

  • bind variables and dynamic sql

    Hi all

    Here's my situation:

    I have a query with 2 bind variable: the FROM clause also uses a variable binding!

    PROCEDURE describe_columns(p_curr_tablename VARCHAR(50), p_curr_intentseq NUMBER)
       IS
          l_cur     INTEGER;
          l_query   VARCHAR (100);
       BEGIN
          l_query :=
             'select * from :table_name where ibmsnap_intentseq = :sequencenr';
          l_cur := DBMS_SQL.OPEN_CURSOR;
          DBMS_OUTPUT.PUT_LINE (p_curr_tablename);
          DBMS_OUTPUT.PUT_LINE (p_curr_intentseq);
          DBMS_OUTPUT.PUT_LINE (l_query);
          DBMS_SQL.PARSE (l_cur, l_query, DBMS_SQL.V7);
          DBMS_SQL.bind_variable (l_cur, ':table_name', p_curr_tablename);
          DBMS_SQL.bind_variable (l_cur, ':sequencenr', p_curr_intentseq);
          DBMS_SQL.DESCRIBE_COLUMNS (l_cur, g_count, g_desc_tab);
          DBMS_SQL.CLOSE_CURSOR (l_cur);
       EXCEPTION
          WHEN OTHERS
          THEN
             DBMS_OUTPUT.put_line ('DF-EXCEPTION: ' || SQLERRM);
             DBMS_OUTPUT.put_line (
                'DF-EXCEPTION: ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE
             );
    
             IF DBMS_SQL.IS_OPEN (l_cur)
             THEN
                DBMS_SQL.CLOSE_CURSOR (l_cur);
             END IF;
       --         RAISE;
       END;
    and the output is:
    CD_B136V4_NEW
    16
     select * from :table_name where ibmsnap_intentseq = :intentseq
    DF-EXCEPTION: ORA-00903: invalid table name
    DF-EXCEPTION: ORA-06512: in "SYS.DBMS_SYS_SQL", line 906
    So is the problem that I want to use a variable binding for the name of the table?

    I'd appreciate any help!
    Thank you!

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:227413938857

    Identifiers cannot be used as variable bind - never. Identifiers must be "hard-coded".
    in the query.

    I can't put in a link for "emp" variable because I can't use a string
    constant for emp.

    The reason is quite simple - a bind variable query is parsed and optimized once
    variables are evaluated before linking. If I could code:

    Select * from: bind_x

    the optimzer would not have an idea of what will come with, security (access rights)
    could be evaluated and so on. We could not develop a plan for this query - not
    enough information. Therefore, no variable bind for identifiers.

  • 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