Get the value of the bind variable in backing bean class VO Impl

Hello

I have a VO that includes a bind "pOrgId" variable, the VO has a java VO Impl class that includes:

/**
* Returns the value of the variable to pOrgId.
value of the variable * @return for pOrgId
*/
public {getpOrgId() number
return (Number) ensureVariableManager () .getVariableValue ("pOrgId");
}

So it is possible to obtain the value is concluded by the binding variable using this class in a backing bean? (I tried to import the VOImpl class in the bean to support, but getpOrgId is not available?).

(JDEV 11.1.2.3.0)

Concerning
Carl

Hello

When you create a ViewObjectImpl class, none of these options is to generate the getter/setter for bind variable. Create a client class interface and expose the get method for the variable binding. Now, you can reference the method since a binding method in the ADF, which you then access a managed bean by calling

  BindingContext bctx = BindingContext.getCurrent();
  BindingContainer bindings = bctx.getCurrentBindingsEntry();
  OperationBinding oper = (OperationBinding) bindings.get("name of the method binding");
  Object returnVal = oper.execute();

Frank

Tags: Java

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

  • Procedure with an unknown name or the amounts of the bind variable.

    Hey gurus,

    I hope someone out there can point me in the right direction.

    I write a PL/SQL function that receives an unknown number of bind variables in the client.
    I use Apex 1.1 earpiece to set up a model of RESTful resource for a x-www-formulaires-urlencoded body POSITION.

    If the client publishes the following body: * "title = M. & fname = John & lname = Smith" * "

    My PL/SQL procedure automatically receives the bind variables which is placed by the following:
    : title: = "M";
    : fname: = "John";
    : lname: = 'Smith ';.

    Now my limit is that the required design uses the metadata to define the structure of data of the end-user.
    So in reality the body of MESSAGE I get more like this: * "M. = 120 & 121 = John & 122 = Smith" * "

    So my PL/SQL procedure receives:
    : 120: = "M";
    : 121: = "John";
    : 122: = 'Smith ';.

    I can query the metadata tables to anticipate what bind variables can be present at the execution,
    but this can change depending on the resource ID with the body of the MESSAGE at the time of the request.

    My first attempt was to be a loop expected elements and run an EXECUTE IMMEDIATE likes:

    for c_record_items in
    (select field_id in the tfields where record_id =: id) loop
    EXECUTE IMMEDIATE ' begin update_item ('|: field_id |', :'|| field_id |'); end;';
    end loop;

    But unfortunately the EXECUTE IMMEDIATE fails because the binding variable is not declared; It requires the USING clause.
    Which I can't think I can code the amount or value in...

    I started dabbling in the DBMS_SQL package but I still have to think of a way I can fix this problem.

    There are experts out there who can direct me in the right direction?
    Very much appreciated.

    Published by: Codes on March 5, 2013 17:11

    Published by: Codes on March 5, 2013 17:13

    I have a lot of procedures where I accumulate the number of bind variables.

    My approach has been to load each variable binding in an associative array and maintain a counter of the number of bind variables.

    Finally, there is a great if then elsif endif block which is actually

    if v_binds = 0
    then
         execute immediate ;
    elsif v_binds = 1
    then
         execute immediate  using bind_array(1);
    elsif v_binds = 2
         execute immediate  using bind_array(1), bind_array(2);
    elsif ...
    end if;
    

    Here is a link:
    Re: USING Dynamic Clause?

    Later, I discovered that you could do something like the following:
    (Asktom)
    http://www.Oracle.com/technetwork/issue-archive/2009/09-Jul/o49asktom-090487.html

    Either of these approaches to solve your problem.

    Added link: Keith Jamieson on 6 March 2013 09:26

  • get the connection variable in jython

    Hi experts,

    How to get the connection variable in the procedure using jython, or to assign the connection of the source variable in variable jython
    as in java bean shell, I used to use these

    Chantal Connection = snpRef.getJDBCConnection ("SRC");

    the procedure, I would like to create is source: oracle, target: jython.

    Thanks in advance

    Hello

    I believe in jython would make it almost similar

    for example

    Chantal = snpRef.getJDBCConnection ("SRC")

    or

    Chantal = odiRef.getJDBCConnection ("SRC")

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • What kind of name of the service can get the method of getServiceName of BluetoothSerialPortInfo class?

    What kind of name of the service can get the method of getServiceName of BluetoothSerialPortInfo class?

    For example, I know that "Serial Port" is a name of service, what other types are there?

    Thank you.

    I answer myself.

    -The name of the service for printer and other devices connected by serial port is "Serial Port".

    -The name of the service for mobile Blackberry is "BlackBerry Desktop Service... »

    -The name of the service for readers of smart card is 'Smart Card Reader BB'

    If you know more, be free to write.

  • How do I see the bind variable values in the output of statspack

    Hi all.

    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64 bit Production
    PL/SQL Release 9.2.0.4.0 - Production
    CORE Production 9.2.0.3.0
    AMT for Solaris: release 9.2.0.4.0 - Production
    NLSRTL Version 9.2.0.4.0 - Production

    Run sprepsql.sql to get full sql and explain the plan of the hash value.
    SQL returns with bind variable: 1: 2: 3, etc.
    How can I know what are the values for bind variables in order to connect and run them in test db?

    Thanks for your help.

    You can't get the values to bind to StatsPack (AFAIK).

    You have to draw a session that is running this / these SQLs (s) to capture the lie.
    Or query V$ SQL_BIND_CAPTURE for the SQL when it runs.

    Hemant K Collette

  • Trace files showing the bind variable value =""

    10g on solaris

    Hi all

    We have a problem with an informatica workflow brings an update statement in Oracle in trems of performace.

    I started using DBMS_SUPPORT tracing with lie the TRUE value. He captured the trace files accordingly against a controlled set of data. Trace TWOT files were produced.

    Trace files first shows the SELECT statement are questions that identifies the records that will be updated.

    The 2nd trace file shows the actual UPDATE statement published as a PL/SQL loop to do the update.

    There are 20 records that users have rigged last updated and the update statement lists 20 cases where updates taking place. All updates occurred successfully after reviewing the results of the post. However my question is why the trace files are showing the values of bind as the value ""?... any ideas appreciated!

    an excerpt of the file trace...
    PARSING IN CURSOR #1 len = 123 dep = uid 0 = 1482 oct = 6 lid = tim 1482 = 994827916280 = ad 3649357857 hv = "8b5b98f0."
    UPDATE / * + index (FCT_TASK IDX_FCT_TASK_CASE_SBL_ROW_ID) * / FCT_TASK SET DWH_LAST_UPD_DT = SYSDATE WHERE CASE_SBL_ROW_ID =: 1
    END OF STMT
    # 1 ANALYSIS: c = 10000, e = 980, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 0, og = 1, tim = 994827916264
    =====================
    PARSING IN CURSOR #5 len = 227 dep = 1 uid = 0 oct = cover 3 = 0 tim = hv 994827919231 = ad 2190775527 = "8e622670".
    Select obj$ o, user$ u u.name, o.name, t.update$, t.insert$, t.delete$, t.enabled, trigger$ t where t.baseobject =: 1 and t.obj #= o.obj # and o.owner # u.user = # and bitand (property, 16) = 0 and bitand (property, 8
    ) = 0 order by o.obj #.
    END OF STMT
    ANALYSIS #5:c = 0, e = 1310, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 1, og = 1, tim = 994827919223
    LINKS FOR #5:
    bind 0: dty = 2 mxl = 22 (22) bad = 00 scl = 00 pre = 00 = 00 = 0001 size = 24 offset = 0 oacfl2 oacflg
    BFP = bln ffffffff7c058d98 = 22 avl = flg 04 = 05
    value = 425212
    EXEC #5:c = 10000, e = 9476, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 1, og = 4, tim = 994827928883
    FETCH #5:c = 0, e = 104, p = 0, cr = 1, cu = 0, set = 0, r = 0, dep = 1, og = 4, tim = 994827929051
    "STAT id #5 = 1 cnt = 0 pid = 0 pos = 1 obj = 0 op =' SORT ORDER BY (cr = 1 pr = 0 pw = time 0 = 172 en)"
    "STAT id #5 = 2 cnt = 0 pid = 1 pos = 1 obj = 0 op ='NESTED LOOPS (cr = 1 pr = 0 pw = time 0 = 110 US)"
    "STAT id #5 = 3 cnt = 0 pid = 2 pos = 1 obj = 0 op ='NESTED LOOPS (cr = 1 pr = 0 pw = time 0 = 105 en)"
    STAT id #5 = 4 cnt = 0 pid = 3 pos = 1 obj = op 79 ='$ TABLE ACCESS BY INDEX ROWID TRIGGER (cr = 1 pr = 0 pw = time 0 = 103 US)'
    "STAT id #5 = 5 cnt = 0 pid = 4 pos = 1 obj = 123 op ='INDEX RANGE SCAN I_TRIGGER1 (cr = 1 pr = 0 pw = time 0 = 78 US)"
    "STAT id #5 = 6 cnt = 0 pid = 3 pos = 2 obj = op 18 ='TABLE ACCESS BY INDEX ROWID OBJ$ (pr = 0 pw = time cr = 0 0 = 0 US)"
    "STAT id #5 = 7 cnt = 0 pid = 6 pos = 1 obj = op 36 ='INDEX SCAN SINGLE I_OBJ1 (cr = 0 pr = 0 pw = time 0 = 0 US)"
    "STAT id #5 = 8 cnt = 0 pid = 2 pos = 2 obj = op 22 =' CLUSTER ACCESS USER TABLE $ (pr = 0 pw = time cr = 0 0 = 0 US)"
    "STAT id #5 = 9 cnt = 0 pid = 8 pos = 1 obj = op 11 ='INDEX UNIQUE SCAN I_USER # (pr = 0 pw = time cr = 0 0 = 0 US)"
    LINKS FOR #1:
    bind 0: dty = 1 mxl = 32 (30) bad = 00 scl = 00 pre = 00 oacflg = 01 oacfl2 = 800000 size = 32 offset = 0
    BFP = bln ffffffff7c17b0a0 = 32 avl = flg 04 = 05
    value =""
    # 1 EXEC: c = 8390000, e = 8740989, p = 55593, cr = 55610, cu = 3, put = 1, r = 1, dep = 0, og = 1, tim = 994836657483
    LINKS FOR #1:
    bind 0: dty = 1 mxl = 32 (30) bad = 00 scl = 00 pre = 00 oacflg = 01 oacfl2 = 800000 size = 32 offset = 0
    BFP = bln ffffffff7c17b0a0 = 32 avl = flg 04 = 05
    value =""
    # 1 EXEC: c = 7980000, e = 7962369, p = 55591, cr = 55608, cu = 1, SIG = 0, r = 1, dep = 0, og = 1, tim = 994844621479
    LINKS FOR #1:
    bind 0: dty = 1 mxl = 32 (30) bad = 00 scl = 00 pre = 00 oacflg = 01 oacfl2 = 800000 size = 32 offset = 0
    BFP = bln ffffffff7c17b0a0 = 32 avl = flg 04 = 05
    value =""


    ect ect ect...



    Concerning
    Satnam
    BINDS #1:
    bind 0: dty=1 mxl=32(30) mal=00 scl=00 pre=00 oacflg=01 oacfl2=800000 size=32 offset=0
    bfp=ffffffff7c17b0a0 bln=32 avl=04 flg=05
    value=""
    

    'dty = 1' indicates that the data type is VARCHAR or NVARCHAR. As the timestamp data types data types BLOB, and various other, bind variables defined as NVARCHAR will not have their values dumped in a 10046 trace file. I suspect that the: 1 binding variable is passed as an a NVARCHAR2.

    Charles Hooper
    Co-author of "Expert Oracle practices: Oracle Database Administration of the Oak Table.
    http://hoopercharles.WordPress.com/
    IT Manager/Oracle DBA
    K & M-making Machine, Inc.

  • Conditionally setting the Bind Variables

    I need help on condition affecting some bind variables so I don't have to hardcode values. However, I get errors when I try to do. I could just go about it the wrong way. This is my code so far:

    DECLARE 
           first_offset varchar2(3);
           second_offset varchar2(3);
           current_term  varchar2(6);
           
    BEGIN
      current_term := (SELECT robinst_current_term_code
      FROM robinst
      WHERE robinst_aidy_code = :aidy)
      
      CASE 
      WHEN current_term LIKE '%60' THEN first_offset := '40'
      AND second_offset := '100'
      WHEN current_term LIKE '%20' THEN first_offset := '100'
      AND second_offset := '160'
      END
      
    END;
    /
    I then use the variable offest in a select query Afterwords. Is it possible, or what I seem to be wrong?

    Published by: blackhole82 on January 23, 2009 14:01

    Published by: blackhole82 on January 23, 2009 14:07

    I don't suggest my query so that you can "show" the values in columns, but if you include my select in your query you will not need any block pl/sql-in all, something like:

    WITH BASE_DATA AS (SELECT robinst_current_term_code,
           CASE WHEN robinst_current_term_code LIKE '%60' THEN
             40
           CASE WHEN robinst_current_term_code LIKE '%20' THEN
             100
           ELSE
              NULL
           END FIRST_OFFSET,
           CASE WHEN robinst_current_term_code LIKE '%60' THEN
             100
           CASE WHEN robinst_current_term_code LIKE '%20' THEN
             160
           ELSE
             NULL
           END SECOND_OFFSET
      FROM robinst
     WHERE robinst_aidy_code = :aidy
    )
    SELECT ....
      FROM .....,
           BASE_DATA
    WHERE .....
    AND F_ENROLLED_THIS_TERM(RCRESAR_PIDM, current_term - first_offset) = 'Y'
    AND MSU_ENROLLED_HISTORY_TERM(RCRESAR_PIDM, current_term - second_offset) = 'Y'
    

    made me?

  • How to get the secondary variable

    Hello

    Can I know how to get the variable of the Secondary VI?

    Please see my VI, when I run the test in high school, I can't any variable in the indicator "get all the control values.

    Is there a wrong?

    Thank you.

    Try this:

  • Convert SQL to take advantage of the Bind Variables

    Hi all

    Is it possible to convert the SQL below so I can enjoy variable Bind?  It's just my personal way of followed by the name of the script that I use on a daily basis... the file is passed to a point that its about 2K lines long, and whenever I run this specific file to get a script name, it creates a new SQL in the database pool shared... I tried to change this option to use bind variables , but it doesn't seem to work properly and I wanted what suggestion of the community...

    ACCEPT script_name_like prompt 'ENTER SCRIPT NAME OR HIT ENTER TO GET ALL SCRIPT NAME OR PUT PART OF THE SCRIPT NAME : ' 
    WITH help_script AS
    ( SELECT 'top_seg_tab_obj_ash'                    AS Script_Name,
                        'top segment by tot wait time' AS Description,
                        '# of mins to go back'            AS INPUT
       FROM dual  
      UNION ALL SELECT 'v$_tab'                    AS Script_Name,
                        'shows list v$ views' AS Description,
                        'view name like'            AS INPUT
       FROM dual
      UNION ALL SELECT 'dba_tab'                    AS Script_Name,
                        'shows list dba views' AS Description,
                        'view name like'            AS INPUT
       FROM dual
      UNION ALL SELECT 'nls_params'                    AS Script_Name,
                        'shows list of current NLS setting for DB/INST/SESS' AS Description,
                        'no Input Needed'            AS INPUT )
    SELECT upper(script_name) AS "MY SCRIPT NAME",
           upper(description) AS description,
           upper(INPUT) AS INPUT
    FROM help_script
    WHERE script_name LIKE nvl('%&script_name_like%', script_name) ;
    

    Hello

    user13454469 wrote:

    Hi all

    Is it possible to convert the SQL below so I can enjoy variable Bind?  It's just my personal way of followed by the name of the script that I use on a daily basis... the file is passed to a point that its about 2K lines long, and whenever I run this specific file to get a script name, it creates a new SQL in the database pool shared... I tried to change this option to use bind variables , but it doesn't seem to work properly and I wanted what suggestion of the community...

    1. ACCEPT script_name_like invites ' ENTER NAME or HIT ENTER to GET ALL THE SCRIPT NAME or PART OF THE SCRIPT the SCRIPT NAME: '
    2. WITH help_script AS
    3. (SELECT "top_seg_tab_obj_ash" AS Script_Name,
    4. "upper segment by tot queue time" AS Description,.
    5. "# of minutes to go back" AS INPUT
    6. OF the double
    7. UNION ALL SELECT ' v$ _tab "AS Script_Name,.
    8. "Show list views$ v ' AS Description,.
    9. 'show the name as' AS ENTRY
    10. OF the double
    11. UNION ALL SELECT 'dba_tab' AS Script_Name,
    12. "Show list views dba" AS Description,.
    13. 'show the name as' AS ENTRY
    14. OF the double
    15. UNION ALL SELECT 'nls_params' AS Script_Name,
    16. 'displays the list of current NLS parameter for DB/INST/SESS' AS Description,.
    17. ("No input is necessary" IN ENTRY)
    18. SELECT upper (script_name) AS "MY SCRIPT NAME",
    19. Upper (Description) as a description,
    20. Upper (Input) AS INPUT
    21. OF help_script
    22. WHERE script_name AS nvl (script_name ' % & script_name_like %',);)

    The WHERE clause (last line) of is the only place where you are using the proxy & script_name_like?  If so:

    -ACCEPT command is exactly the same as before

    ACCEPT script_name_like invites ' ENTER NAME or HIT ENTER to GET ALL THE SCRIPT NAME or PART OF THE SCRIPT the SCRIPT NAME: '

    VARIABLE script_name_like_b VARCHAR2 (30)

    EXEC: script_name_like_b: = '% & script_name_like;

    WITH the help _script AS

    ...

    WHERE script_name AS NVL (: script_name_like_b, script_name);

  • pass the binding variable to the af:table using the menu drop-down

    I need to create an af:table to pull all employees belonging to a Department. I created the table based on a viewobject.

    The query in the view object has a variabe bind, for example:

    Select * from employee where deptname to (select deptname of Department where deptid =: deptid)

    My question is how to get the deptid selected in a drop-down list value passed to the query of the table of the adf?

    The user, what version jdev you use?

    Where is the location THAT LOV located on the page? Once you have the service ID, you can use the executeWithParams to run the query and display the result in the table.

    If this isn't what you want to elaborate on the use case.

    Timo

  • is there an order to the bind variable in v$ SQLTEXT_WITH_NEWLINES?

    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE     11.2.0.2.0     Production
    TNS for HPUX: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    create and populate the table
    CREATE TABLE mytable
    (
       seq_cd   NUMBER (6) PRIMARY KEY,
       col1     VARCHAR2 (10),
       col2     VARCHAR2 (10),
       col3     VARCHAR2 (10),
       col4     VARCHAR2 (10),
       col5     VARCHAR2 (10),
       col6     VARCHAR2 (10)
    );
    
    INSERT INTO mytable (seq_cd,
                         col1,
                         col2,
                         col3,
                         col4,
                         col5,
                         col6)
         VALUES (1,
                 'one',
                 'two',
                 'three',
                 'four',
                 'five',
                 'six');
    I want to know if there is a consistent order of how bind variables are placed in v$ SQLTEXT_WITH_NEWLINES is always last in first out?
    DECLARE
       mybindvariablelist   SYS.odcivarchar2list;
       vseq_cd              NUMBER (6) := 1;
       vcol1                VARCHAR2 (10) := 'one';
       vcol2                VARCHAR2 (10) := 'two';
       vcol3                VARCHAR2 (10) := 'three';
       vcol4                VARCHAR2 (10) := 'four';
       vcol5                VARCHAR2 (10) := 'five';
       vcol6                VARCHAR2 (10) := 'six';
    BEGIN
       mybindvariablelist :=
          sys.odcivarchar2list (vseq_cd,
                                vcol1,
                                vcol2,
                                vcol3,
                                vcol4,
                                vcol5,
                                vcol6);
    
       INSERT INTO mytable (seq_cd,
                            col1,
                            col2,
                            col3,
                            col4,
                            col5,
                            col6)
            VALUES (vseq_cd,
                    vcol1,
                    vcol2,
                    vcol3,
                    vcol4,
                    vcol5,
                    vcol6);
    EXCEPTION
       WHEN OTHERS
       THEN
          DECLARE
             TYPE sess_data IS RECORD
             (
                curr_sqladd   RAW (8),
                curr_sqlid    VARCHAR2 (20),
                prev_sqladd   RAW (8),
                prev_sqlid    VARCHAR2 (20)
             );
    
             sess_info   sess_data;
             sess        VARCHAR2 (100) := USERENV ('SESSIONID');
             idx         PLS_INTEGER;
          BEGIN
             DBMS_OUTPUT.put_line (SQLERRM || ' when executing ');
    
             SELECT sql_address,
                    sql_id,
                    prev_sql_addr,
                    prev_sql_id
               INTO sess_info
               FROM v$session
              WHERE audsid = sess;
    
             FOR cur IN (  SELECT sql_text
                             FROM v$SQLTEXT_WITH_NEWLINES
                            WHERE address = sess_info.prev_sqladd
                         ORDER BY piece ASC)
             LOOP
                DBMS_OUTPUT.put_line (cur.sql_text);
             END LOOP;
    
             idx := mybindvariablelist.FIRST;
    
             WHILE (idx IS NOT NULL)
             LOOP
                DBMS_OUTPUT.put_line (
                   ':B' || idx || ' = ' || mybindvariablelist (idx));
                idx := mybindvariablelist.NEXT (idx);
             END LOOP;
          END;
    END;
    results in
    ORA-00001: unique constraint (DSAMSTRC.SYS_C0093919) violated when exeduting 
    INSERT INTO MYTABLE (SEQ_CD, COL1, COL2, COL3, COL4, COL5, COL6)
     VALUES (:B7 , :B6 , :B5 , :B4 , :B3 , :B2 , :B1 )
    :B1 = 1
    :B2 = one
    :B3 = two
    :B4 = three
    :B5 = four
    :B6 = five
    :B7 = six
    so as you can see from the output of the order of the table v$ and order, I entered bind variables are reversed. Is this always the case or it is not consistent?

    Pollywog wrote:
    so as you can see from the output of the order of the table v$ and order, I entered bind variables are reversed. Is this always the case or it is not consistent?

    I guess it's just a matter of curiosity, right? All that matters is to connect the variable ends up in a good position. Anyway, as far as I KNOW, Oracle creates a bind variable in the order, and therefore depends on the analysis from left to right or from right to left. And we don't know how to change the order in the different versions of Oracle.

    SY.

  • Use the bind variable in example of a clause giving questions

    create or replace procedure pr_mbk (p_val in number)
    is
    CROR type is ref cursor;
    REF CROR;
    type numbertype is the table of index number of pls_integer;
    numtype numbertype.
    v_str varchar2 (2000): = 'select empno from emp sample(:val) ";
    Start
    Open ref for v_str using p_val;
    Close ref;
    end;
    /

    Successfully compiled.

    But when I run the same

    Exec pr_mbk (10);

    ERROR on line 1:
    ORA-00933: SQL not correctly completed command.
    ORA-06512: at "SCOTT. PR_MBK', line 9
    ORA-06512: at line 1

    My question is can use us Bind variables within a sample clause.

    Receive your answer.

    Thank you
    Madhu K.

    I guess that SAMPLE is considered as a special case, and is not considered as something that takes a 'value' in the same way as values in where clause or values in the query itself.
    Let's face it, the SAMPLE is not the standard SQL syntax and is probably something Oracle implements in a separate thread for processing SQL itself i.e. engine Oracle saying to herself... "I will remember this bit of the sample until I questioned the data using the SQL engine, so I'll take a suitable sample of the results," but it's the SQL engine treats the binding of values and the Oracle process that awaits the results taste, knows nothing of the binding values in it's special EXAMPLE of keyword.

  • How to get the global variable for an instanceId

    Hello

    I have data in global variables of an instance level. And using that instanceId, how can I get the global-level variables data.

    Please me tips


    Thank you
    Sailendra

    Hello
    I guess you want to get the value of the external variable within the process. You can do like this:

    assuming that it is of type string. For other types of type cast properly...
    String extVarValue = (String) (New Component(instance: this)).get(attribute: extVarName);

    Replace "extVarName" with your project name. It returns the value of your project for the instance that you are currently working.

    -Thank you,
    Malar.

  • How do I know the bind variables in sql_text from V$ sql

    I have query V$ sql, v$ sqlarea, V$ SQLTEXT, the spectacle of sql_text as select client_name to the customer where id =: B1;
    How can I get the value of: B1?
    I want to know the entire SQL command, what should I do?

    Kandi Sissi wrote:
    Not too sure, but check out the GV$ SQL_BIND_CAPTURE.

    Satish,
    I remember reading an anomaly that JL posted on this topic, I guess that it would be useful to know that there may be settings that can tweakthe behavior from this point of view, OP.
    http://jonathanlewis.WordPress.com/2008/07/24/bind-capture/
    Concerning
    Aman...

Maybe you are looking for