Value data named to bind variables of Type table

Hello

I have a display object with a query that has a where clause, clause which use 'en' (e.g. Select projTitle PROJECT where PROJID in: projIds)

'projIds' is a variable of type table of liaison.

I'm moving in that variable binding expects (an array of projIds that can be used by the sql statement), and I did not. I'm calling a method in the bean to support the named child tag data from the action tag in the pageDef file links section.

Can you give me the proper syntax and object Array as this variable binding will accept, please? Maybe I used the wrong NDType? I found a couple of different options, but none that I can make it work.

The page definition file:

< action IterBinding = "ProjPendingApprovalByApproverVO1Iterator" id = "loadPendingApproval".

InstanceName = "SystemAMDataControl.RooProjIdArrayt.ApprovalAM1.ProjPendingApprovalByApproverVO1"

DataControl = "SystemAMDataControl" RequiresUpdateModel = "true" Action = "executeWithParams" >

< NamedData NDName = 'PROJID"NDValue =" #{dashboard.projIdArray} "NDType="oracle.jbo.domain.Array"/ >"

< / action >

Application of VO:

SELECT ProjectEO.PROJ_ID,

ProjUtnDtlEO.UTN_TYPE,

ProjectEO.PROJ_SHORT_DESC,

ProjUtnDtlEO.PROJ_DTL_ID,

ProjectEO.PROJ_OWNER,

VEmployeeInfoEO.FIRST_NAME,

VEmployeeInfoEO.EMPLOYEE_ID,

VEmployeeInfoEO.FIRSTNAMELASTNAME,

VEmployeeInfoEO.LAST_NAME,

VEmployeeInfoEO.LASTNAMEFIRSTNAME,

ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_DTL_ID,

ProjApproverEO.PROJ_APPROVER_ID,

ProjApproverEO.APPROVER_LEVEL,

ProjApproverEO.APPROVER_NUMBER,

ProjApproverEO.APPROVER_ROLE,

ProjApprovalDecisionDtlEO.COMMENTS,

ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_ID,

ProjApprovalDecisionDtlEO.LASTUPDATEDBY,

ProjApprovalDecisionDtlEO.APPROVEDDATE,

ProjectEO.SYS_STATUS,

ProjApproverEO.LASTUPDATEDBY AS LASTUPDATEDBY1,

ProjApprovalDecisionDtlEO.PROJ_APPROVAL_TYPE_ID,

ProjStatusLkpEO.STATUS_DESC,

ProjStatusLkpEO.PROJ_STATUS_ID,

ProjectEO.PROJ_CATEGORY_ID,

STRING. APPROVAL_DESC

OF PTS. ProjectEO PROJECT,

PTS. PROJ_UTN_DTL ProjUtnDtlEO,

PTS. V_EMPLOYEE_INFO VEmployeeInfoEO,

PTS. PROJ_APPROVAL_DECISION_DTL ProjApprovalDecisionDtlEO,

PTS. PROJ_APPROVER ProjApproverEO,

PTS. PROJ_STATUS_LKP ProjStatusLkpEO,

PTS. Channel PROJ_APPROVAL_CHAIN_LKP

WHERE ((ProjectEO.PROJ_ID = ProjUtnDtlEO.PROJ_ID (+))

AND (ProjectEO.PROJ_ID = ProjApprovalDecisionDtlEO.PROJ_ID))

AND (ProjectEO.PROJ_ID = ProjApproverEO.PROJ_ID)

AND (ProjectEO.SYS_STATUS = ProjStatusLkpEO.SYS_STATUS)

AND (ProjectEO.PROJ_OWNER = VEmployeeInfoEO.EMPLOYEE_ID)

AND (ProjApprovalDecisionDtlEO.PROJ_APPROVER_ID = ProjApproverEO.PROJ_APPROVER_ID)

and PROJAPPROVEREO. PROJ_APPROVAL_CHAIN_ID = STRING. PROJ_APPROVAL_CHAIN_ID

AND (ProjApprovalDecisionDtlEO.PROJ_APPROVAL_DECISION_ID = 0)

and PROJAPPROVEREO. APPROVER_LEVEL <>2

and PROJAPPROVEREO. PROJ_ID in: PROJID

Thank you!


Please refer to http://www.jobinesh.com/2010/09/using-bind-variable-for-sql-statements.html?m=1 for an example of this.

Timo

Tags: Java

Similar Questions

  • Query report back "No data found" with bind variables

    I put a simple query in the report query:

    Select "bluefish". 'name' as 'name',
    "bluefish". "" primary_flag "as"primary_flag. "
    "bluefish". "" status "than"status. "
    "bluefish". ' ' ID ' as 'ID' of "bluefish" "bluefish" where "bluefish". "" ID "=: P3_XPRINTID

    When I test the query, the data is returned. However, when I try to run the query using the "Test report" button, I get an error 01403 no data found. If I replace the link with an explicit value variable, the report runs.

    Anyone have any ideas as to what is causing this problem? I use the generic report layout, with different types of output. I'M editting the query and set the binding variable before test report (otherwise, the query is not executed).

    Charles

    In fact the report would go - unlike other products of Oracle who complain about a missing binding variable, Apex is not complaining but interprets as a null value. So if you hurt typed the name of your variable, you are never alerted to it.

    Check the Session window to make sure that it is a value - the most common questions are that you named the wrong variable in the query or your item has no value in session state again.

  • How to select data in multiple binding variables

    Hello


    I need to load data into multiple variable binding how


    From now on, I use this


    Select a, b in: a,: b double


    But I still want a responsible being in both: an and: also b to load into c: b and: d Please suggest


    Thank you
    Sudhir.

    Select a, b, a, b in:,: b: c: d double

  • Update MS SQL for APEX pl/sql - Bind variable/field process table

    I created a page APEX that updates a table of linked server sql through the call to a pl/sql process 'submit '.
    The anonymous pl/sql block refers to a hidden field on the page titled "P3_RECORD_ID" in the place where it is clause.
    The pl/sql block, I invoke is:

    Start
    commit;
    Update "SRSRATINGS".
    'Status' value = 'PASS '.
    where "Record_ID" =: P3_RECORD_ID;
    commit;
    end;

    This is block if I replace it with a literal numeric value for the variable/hidden bind field: P3_RECORD_ID. However, when I use the link variable: P3_RECORD_ID, I get the following error:

    ORA-02070: SRS database. MSSQL does not support the TO_NUMBER in this context

    He doesn't seem to understand that P3_RECORD_ID is a reference to the primary key on the form field.

    Any help is appreciated.

    Hello:

    Try if edit the pl/sql block below work

    declare
    l_num number := :P3_RECORD_ID;
    begin
    commit;
    update "SRSRATINGS"
    set "Status" = 'PASS'
    where "Record_ID" = l_num ;
    commit;
    end;
    

    CITY

  • If it is possible to pass the variable of type table in sceduler.

    Hello

    need to schedule a task to call a procedure but procedure a array as a parameter.

    Let me know we can pass the type of object as a parameter in the Scheduler.

    procedure definition: procedure (number, varchar2, ch. pakage.table_type b)

    I don't think that you can do with a PL/SQL type in a package, but you can do it with a SQL type, as shown below.

    Scott@orcl12c > test_tab CREATE TABLE

    2 (col1 NUMBER,

    VARCHAR2 (30) 3 col2.

    col3 4 VARCHAR2 (30))

    5.

    Table created.

    Scott@orcl12c > CREATE or REPLACE TYPE table_type AS TABLE OF VARCHAR2 (30);

    2.

    Type of creation.

    Scott@orcl12c > test_proc CREATE OR REPLACE PROCEDURE

    2 (a NUMBER;

    3B VARCHAR2,

    4 c. table_type)

    5 AS

    6 BEGIN

    7 BECAUSE I have 1... c.COUNT LOOP

    8 INSERT INTO test_tab (col1, col2, col3) VALUES (a, b, c (i));

    9 END OF THE LOOP;

    10 END test_proc;

    11.

    Created procedure.

    Scott@orcl12c > SHOW ERRORS

    No errors.

    Scott@orcl12c > START

    2 DBMS_SCHEDULER. CREATE_JOB

    3 (job_name-online 'test_job',

    job_type 4-online "procedure_stockee."

    5 job_action-online 'test_proc. "

    6 number_of_arguments-online 3);

    7 DBMS_SCHEDULER. SET_JOB_ARGUMENT_VALUE

    8 (job_name-online 'test_job',

    argument_position 9-online 1.

    argument_value 10-10 online);

    11 DBMS_SCHEDULER. SET_JOB_ARGUMENT_VALUE

    12 (job_name-online 'test_job',

    13 argument_position-online 2

    14 argument_value-online 'test');

    15 DBMS_SCHEDULER. SET_JOB_ANYDATA_VALUE

    16 ("test_job", 3, sys.anydata.convertCollection (table_type ("Oracle", "database")));

    17 DBMS_SCHEDULER. SELECT ("test_job");

    18 END;

    19.

    PL/SQL procedure successfully completed.

    Scott@orcl12c > DBMS_LOCK EXEC. SLEEP (5)

    PL/SQL procedure successfully completed.

    Scott@orcl12c > SELECT * FROM test_tab

    2.

    COL1 COL2 COL3

    ---------- ------------------------------ ------------------------------

    10 test Oracle

    test 10 database

    2 selected lines.

  • Not able to bind variable Fusion Dev Guide Document clearly as follows.

    Dear all,

    I have a problem following the merger Developer Guide specifically items link below

    http://docs.Oracle.com/CD/E23943_01/Web.1111/b31974/bcquerying.htm#CHDDHIHJc
    1.     (Request begins and application module is acquired)
    2.  Call setWhereClause(null) to clear WHERE clause
    3.  Call setWhereClauseParam(null) to clear the WHERE clause bind variables
    4.  Call setWhereClause() that references n bind variables
    5.  Calling setWhereClauseParam() to set the n values for those n bind variables
    6.  Calling executeQuery()
    7.  (Application module is released)
    I actually wanted to erase all my bind variables including the binding variable that I put in the request.
    SELECT Persons.PERSON_ID, 
           Persons.PRINCIPAL_NAME, 
           Persons.TITLE, 
           Persons.FIRST_NAME, 
           Persons.LAST_NAME, 
           Persons.PERSON_TYPE_CODE, 
           Persons.SUPPLIER_ID, 
           Persons.PROVISIONED_FLAG, 
           Persons.PRIMARY_ADDRESS_ID, 
           Persons.REGISTERED_DATE, 
           Persons.MEMBERSHIP_ID, 
           Persons.EMAIL, 
           Persons.CONFIRMED_EMAIL, 
    FROM PERSONS Persons
    WHERE Persons.PERSON_TYPE_CODE = :PERSON_TYPE_CODE_PARAM
    Step 3 is where I'm having a problem. I can't find in the API on setWhereClauseParam (null) which accepts the string but
    It has only setWhereClauseParam (int, String)

    Not sure if I'm running on a bug in the documentation.


    JDEV 11G PS5

    That look like a bug in documentation for me.
    The correct method to call is

    setWhereClauseParams(null); //note the 's' in Params!
    

    Timo

  • The wrong data type on bind variable

    We are testing framework entity with ODP.NET and linq to entities and have a little problem.

    We run a simple linq to entities statement with a variable binding and our problem is that the column in the oracle database is the CHAR type framework but entity sends the binding as NVARCHAR2 variable. This causes the oracle do not use the index on the column and a full table scan is performed.

    Entities are generated from the database.

    LINQ:
    public string Name (string value)
    {
    var object = (from s in ctx3. TABLE
    where s.COLUMN1 is value
    Select s.COLUMN2). ToList();
    Returns the object [0]. ToString();
    }

    Is there a way to set the data type for a variable binding when you use linq?

    Published by: 872217 on March 13, 2012 04:42

    Because the .NET string is in Unicode, by default, NVARCHAR2 is used in the binding of parameter to string variables.

    EntityFunctions.AsNonUnicode (of use) should be able to say ODP.NET you want to treat a non-Unicode string.
    In this case, VARCHAR2 should be used for the link.
    I hope this will save for you table scan when there is no conversion data more.

    using System.Data.Objects;

    public string Name (string value)
    {
    var object = (from s in ctx3. TABLE
    where s.COLUMN1 is EntityFunctions.AsNonUnicode (value)
    Select s.COLUMN2). ToList();
    Returns the object [0]. ToString();
    }

    Please let me know if it works for you.

  • Bind variables and dates

    I am writing a process to delete records based on dates.

    Here is the chart:

    Column name Data type Nullable Default Primary key
    IDNUMBERNO.-1
    CT_NAMEVARCHAR2 (100)Yes--
    CT_CATEGORYVARCHAR2 (100)Yes--
    BASE_PTSNUMBERYes--
    PROD_PTSNUMBERYes--
    REF_PTSNUMBERYes--
    START_DATEDATEYes--
    END_DATEDATEYes--
    CREATED_ONDATEYes--
    CREATED_BYVARCHAR2 (50)Yes--
    UPDATED_ONDATEYes--
    UPDATED_BYVARCHAR2 (50)Yes--

    start_date and end_date are the fields of date key.

    The query will remove the dates with specific start and end dates.  The question I have, is that I get a ORA-01858: a non-digit character was found here where was waiting for a digital error while the query is running.

    remove from ct_point_values

    where start_date =: P4_START_DATE_V

    and end_date =: P4_END_DATE_V

    If I run the query in the sql window, no problem:

    remove from ct_point_values

    where start_date =' 01 / 01/2014 '

    and end_date = 31 December 2014"

    Find the query with the works of values hard-coded.  Links to fail.  I tried casting and to_char to_date variations with no luck.

    One thing that I notice, is that when I go to enter my bind variables in the sql workshop, the fields are pre-populated with this:

    1 & amp; #x2F 1 & amp; #x2F; 2014

    12 & amp; #x2F 31 & amp; #x2F; 2014

    01/01/2014 and 31/12/2014.  I found that the only element relates to this suggests that this is a possible bug:

    SQL Bind Variables workshop - Date issues

    Any thoughts on how to address this issue, or is it really a bug?

    I run on Apex 4.2, 11g.

    Thank you!

    Hello

    I guess that these dates come from elements on the page to which the user can select a range of dates.

    These fields have a custom format mask?

    What seems to be the case for me, is that these fields have an explicit format mask (for example: DD/MM/YYYY) but the default database/session format mask is something different (e.g. DD-MON-YYYY).

    I suppose also that the issue in the SQL workshop isn't something related.

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

  • MB of Pass value to bind variable Groove

    Hello world. my version is 11.1.2.2

    I have a bean managed on the basis that contains two components of input (ex: name of user, pswd)
    I'm moving the input value to a query of VO that have variables bind with Groove. as adf.context.current...
    If it is possible, what is the expression to access the value of the bean components managed?

    THX

    Just follow this
    (1) for the vo, generate the VOImpl and when you create, select the variable bind method also
    (2) has the VOimpl who take a parameter, set the varialbe bind using the method and run the query method
    (3) expose this method as a customer interface
    (4) in the pagedefinition file, create an action method and select this method and have a binding method
    (5) of the managed bean, use the following code to execute the method

    OperationBinding operation = bindings.getOperationBinding("operation_name");
             operation.getParamsMap().put("parameter_name", parameterValue); /// this will be u r bind variable parameter
             operation.execute();
             if (operation.getResult() != null) {
                      Boolean result = (Boolean) operation.getResult(); // cast to the expected result type
            }
    
  • How to check if the variable (of type uint) has a value or not?

    Hi all

    I'm just trying to write an instruction conditional to check if my uint variable has a value or not.  I tried to check "null" and "undefined", but without any luck (see below)

    private var _tempIndex:uint;

    ...

    ...

    If (_tempIndex! = null) {}

    code here

    }

    had an error with that one, then tried

    If (_tempIndex! = undefined) {}

    code here

    }

    had an error with that as well.

    So, how can I check if a variable has been assigned a value or not? Any ideas? Thanks in advance!

    Mike

    A uint always has a value between 0 and 2 ^ 32-1 inclusive. It cannot store a value 'no' as undefined or null. If you declare a variable of type uint without assigning a value, it is given a default value of 0.

    You need to maintain an indicator Boolean separate or to use a type of data larger such as number (which can store NaN), object (which can store NaN or null), or * (which can store a value, including NaN, null, and undefined).

    Gordon Smith

    Adobe Flex SDK team

  • default values for VO bind variable

    Hi all

    I have a VO with bind variable year and month

    These variables have values as:


    year:

    cannot import

    DF = new SimpleDateFormat("yyyy")

    DF.format (ADF. CurrentDate)

    month:

    cannot import

    DF = new SimpleDateFormat ("MM")

    DF.format (ADF. CurrentDate)

    I have a table in my application this VO-based. I added these two variables as a counter entry number and a command button (ExecuteWithParams)

    The table is delivered with these variables dafult (2014 & 2). That's ok. Problem is that default values are not in the number of counters during the loading of the page.

    When I enter the new values (2014 & 1) and click the button, the new values to come and there is no problem...

    JDev version is 11.1.2.4

    Thank you...

    I find the solution as:

    In the pageDefinition file > binaries > ExecuteWithParams1_p_year > DefaultValue value as value: #{MyBean.year}

  • 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

  • SQL Bind Variables workshop - Date issues

    I use SQL Workshop to run through some queries. I'm having a problem with Bind Variables that contain dates. I enter the following date:

    12/12/2013

    but it is converted to:

    12 & amp; #x2F 12 & amp; #x2F; 2013

    I'm doing something wrong?

    Thank you
    Glen

    It looks like a bug. It should not escape what either.

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

  • bind variables using the values in the collection

    Hi the gems... Good afternoon...

    Can we not use plsql values in the collection in the USING clause to pass the bind variable values...

    I wrote the procedure to kill all sessions that cross the parameter OPEN_CURSORS below. the query, I found only three sessions that exceed. But when I execute my procedure so those are not removed, execution gives me an error also. He simply executed but no session has been killed.

    My part of the code is as below:
    ..........
    ..........
    ..........
    OPEN rc FOR v_sql;
        FETCH rc BULK COLLECT
            INTO v_tt_sessions;
        LOOP
            EXIT WHEN v_tt_sessions.COUNT = 0;
            FOR idx IN 1 .. v_tt_sessions.COUNT
            LOOP
                EXECUTE IMMEDIATE 'alter system kill session '':a,:b'' immediate'
                    USING v_tt_sessions(idx).sid, v_tt_sessions(idx).serial#;
            END LOOP;
        END LOOP;
    CLOSE rc;
    .........
    .........
    However, when I replace the bind variable with the values in the collection, then it works:
    ..........
    ..........
    ..........
    OPEN rc FOR v_sql;
        FETCH rc BULK COLLECT
            INTO v_tt_sessions;
        LOOP
            EXIT WHEN v_tt_sessions.COUNT = 0;
            FOR idx IN 1 .. v_tt_sessions.COUNT
            LOOP
                EXECUTE IMMEDIATE 'alter system kill session '''||v_tt_sessions(idx).sid||','||v_tt_sessions(idx).serial#||''' immediate';
            END LOOP;
        END LOOP;
    CLOSE rc;
    ..........
    ..........
    Please suggest if there is something wrong in my code first. I tried, but could not get any inadequacy.

    But the doubt is when I removed the variable of liaison with the values of the collection hard-coded (in my first post), then this process works very well. But I want to use bind variables.

    You cannot use bind variables in this situation. You can use bind variables for the DML statements.
    I'm surprised that you have no error, but I guess that this block of code explains everything:

    EXCEPTION
        WHEN OTHERS THEN
            dbms_output.put_line(SQLCODE || ' : ' || SQLERRM);
      
    

    You concatenate values to build a single command ALTER SYSTEM and run, just like your second attempt.
    You don't need to have a dynamic cursor either.

    for r in (
      select v.SID, u.serial#, count(v.sid)
      from v$open_cursor v, v$session u
      where v.CURSOR_TYPE='OPEN'
      and v.sid=u.sid group by v.sid, u.serial#
      having count(v.sid)>190
      order by count(*) desc
    )
    loop
      execute immediate 'alter system kill session '''||r.sid||','||r.serial#||''' immediate';
    end loop;
    

    And of course, I agree with the comments of Keith (assuming that this is not just an exercise).

    Published by: odie_63 on October 16, 2012 14:03

Maybe you are looking for