Select..from...where...in(sAux)

Hi,
is there a way to have a cursor in a plsql which receives a
parameter used in a IN (....) condition like this:
     PROCEDURE ProcAux
     ( psList IN VARCHAR2,
     pnRet OUT NUMBER)
     IS
CURSOR C1 (sList VARCHAR2) IS
SELECT col1, col2
FROM table
WHERE col1 IN (sList); -- <<<-----
C3REC C1%ROWTYPE;
BEGIN
     OPEN C1(psList);
     <<LOOP_C3REC>>
     LOOP
END ProcAux;
Thank you very much,
Andres.

DBCA Not Launching

Similar Messages

  • What is the defference between select single * from and select * from Where

    What is the defference between select single * from and select * from Where
    which is prefferable and best one.

    Hai,
    *Difference Between Select Single and Select * from table UpTo One Rows:*
    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly:  to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.

  • SELECT FROM WHERE fileName = args[0]

    I'm trying to select with the args[0] parameter.
    1. Here's the problem code:
    ResultSet tt = statement.executeQuery("SELECT * FROM tblSite WHERE tblSite.chrFileName = '" & args[0] & "'");
    2. If I try the following, it works:
    ResultSet tt = statement.executeQuery("SELECT * FROM tblSite WHERE tblSite.chrFileName = 'supply2'");
    3. supply 2 is what args[0] contains. Why isn't it working?
    Can you help?
    Thanks.

    Change your string to use the "+" concatenation operator, instead of "&".
    "SELECT * FROM tblSite WHERE tblSite.chrFileName = '" + args[0] + "'";

  • How do I do SELECT * FROM TABLE WHERE KEY IN ({list})?

    The title says it all really.
    Is there a reasonable performant way to perform the query
    SELECT * FROM TABLE WHERE KEY IN ({list})where {list} is String []?
    I am currently creating a PreparedStatement with a for loop like this   StringBuffer sb = new StringBuffer ("SELECT * FROM TABLE WHERE ID IN (");
      for (int ii=0;ii<keys.length;ii++) {
        sb.append (keys [ii]);
        if (ii != keys.length-1) sb.append (",");
      sb.append (")");but this means that the prepared statement is created each time I call my method and so I'm not sure that the optimizer will find it easy to cope with. Is there a construction that I'm missing along the lines of SELECT * FROM TABLE WHERE KEY = ? where I can create the PreparedStatement once and just call setObject or something on it when the values in {list} change?

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • Select * from TABLE where Filed like pa_input.

    Hello,
    the following works fine
    select * from ZTABLE INTO wa_myarea WHERE myfield LIKE 'a%'.
    Now I don't want to hard code the selection criteria for myfield, but let the user select one, so I did:
    parameters pa_input type mytype.
    select * from ZTABLE INTO wa_myarea WHERE myfield LIKE pa_input.
    If the user enters now for example a% everything works again fine. But I assume that a user rather would enter a* for a wild card search and that doesn't work. Do I have to manually replace all * in my variable with % before I run the select statement? I hope not... What would be the best way?
    Thanks.

    Moderator message - Please do not ask basic questions - thread locked
    Rob

  • SELECT * FROM table WHERE id NOT IN?  Help with statement.

    Hi,
    Two tables. Orders (orderID = PK) and Paid Orders (orderID =
    FK)
    I want to display a recordset of orders from the Orders table
    where the
    order ID doesn't appear in the Paid Orders table.
    I have tried something like this:
    SELECT *
    FROM dbo.tblOrders
    WHERE orderID NOT IN ( SELECT TOP 100 PERCENT
    tblPaidOrders.orderID FROM
    dbo.tblPaidOrders )
    ...no joy with that though. Would appreciate some guidance.
    Thank you.
    Regards
    Nath.

    Hi Nancy,
    Before I begin that, can I ask if there is an issue with the
    OR?
    I need it to be:
    (orderID IN (SELECT qryPaidOrders.orderID FROM qryPaidOrders)
    ORDER BY
    orderdate ASC) AND ((customerid = MMColParam1) OR (vanopID =
    MMColParam2))
    MMColParam1 is exactly the same as MMColParam but, for some
    reason
    unbeknowns to me, DW8.0.2 won't allow me to use it twice.
    That's neither
    here nor there though, as creating a 2nd variable
    (MMColParam2) solves that
    particular issue.
    Do I need additional ( ) anywhere considering it is an OR
    though?
    Thanks.
    nath.
    "Nancy *Adobe Community Expert*" <[email protected]>
    wrote in message
    news:[email protected]...
    >I would think so .. now that you have the core statement
    working .. try
    >adding the other portions. Put the main statement in ( )
    and add the
    >others. Like this:
    >
    > SELECT *
    > FROM dbo.qryOrders
    > WHERE (orderID IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    > ORDER BY orderdate ASC) AND (customerid = MMColParam1)
    AND (vanopID =
    > MMColParam2)
    >
    > See what that gives you and fiddle with those till you
    get what you want.
    >
    >
    > --
    > Nancy Gill
    > Adobe Community Expert
    > BLOG:
    http://www.dmxwishes.com/blog.asp
    > Author: Dreamweaver 8 e-book for the DMX Zone
    > Co-Author: Dreamweaver MX: Instant Troubleshooter
    (August, 2003)
    > Technical Editor: DMX 2004: The Complete Reference, DMX
    2004: A
    > Beginner's
    > Guide, Mastering Macromedia Contribute
    > Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced
    PHP Web
    > Development
    >
    >
    >
    >
    > "tradmusic.com" <[email protected]> wrote
    in message
    > news:[email protected]...
    >> Hi,
    >>
    >> After a bit of twiddling, I changed the statement to
    this:
    >>
    >> SELECT *
    >> FROM dbo.qryOrders
    >> WHERE orderID IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    >> ORDER BY orderdate ASC
    >>
    >> ...and it displays only those records who appear in
    the Paid Orders
    >> table. If I change this to NOT IN, it displays only
    the orders in the
    >> Orders table.
    >>
    >> Ideal, but I need to apply the customerID and
    vanopID variables....is
    >> that possible within this one statement?
    >>
    >> Really appreciate the help,
    >> Regards
    >> Nath.
    >>
    >> "Nancy *Adobe Community Expert*"
    <[email protected]> wrote in message
    >> news:[email protected]...
    >>> You've added to it since the first post. Take
    out the customerID and
    >>> vanopID parts and try focusing on just the
    orderID part. Get that
    >>> working first.
    >>>
    >>> I would try seeing if you can select those
    orderID's that are IN the
    >>> subquery first .. that would see whether or not
    the problem is the NOT
    >>> .. which should work .. but let's see first
    whether the culprit is the
    >>> query structure or not. See if you can select
    the orderID's that are in
    >>> the paid orders table from the main query.
    >>>
    >>>
    >>> --
    >>> Nancy Gill
    >>> Adobe Community Expert
    >>> BLOG:
    http://www.dmxwishes.com/blog.asp
    >>> Author: Dreamweaver 8 e-book for the DMX Zone
    >>> Co-Author: Dreamweaver MX: Instant
    Troubleshooter (August, 2003)
    >>> Technical Editor: DMX 2004: The Complete
    Reference, DMX 2004: A
    >>> Beginner's
    >>> Guide, Mastering Macromedia Contribute
    >>> Technical Reviewer: Dynamic Dreamweaver MX/DMX:
    Advanced PHP Web
    >>> Development
    >>>
    >>>
    >>> "tradmusic.com"
    <[email protected]> wrote in message
    >>> news:[email protected]...
    >>>> Hi Nancy,
    >>>>
    >>>> Have just tried that, but it is still
    displaying records whose orderID
    >>>> is also in a record in the Paid Orders
    table?
    >>>>
    >>>> I've got:
    >>>>
    >>>> SELECT *
    >>>> FROM dbo.qryOrders
    >>>> WHERE customerID = MMColParam OR vanopID =
    MMColParam1 AND orderID NOT
    >>>> IN (SELECT qryPaidOrders.orderID FROM
    qryPaidOrders)
    >>>> ORDER BY orderdate ASC
    >>>>
    >>>> Hope you can help.
    >>>> Thanks. :o)
    >>>> Nath.
    >>>>
    >>>>
    >>>> "Nancy *Adobe Community Expert*"
    <[email protected]> wrote in message
    >>>> news:[email protected]...
    >>>>> Why couldn't your inner query just be
    SELECT orderID from
    >>>>> dbo.tblPaidOrders? Wouldn't the top 100%
    be all of them?
    >>>>>
    >>>>>
    >>>>> --
    >>>>> Nancy Gill
    >>>>> Adobe Community Expert
    >>>>> BLOG:
    http://www.dmxwishes.com/blog.asp
    >>>>> Author: Dreamweaver 8 e-book for the DMX
    Zone
    >>>>> Co-Author: Dreamweaver MX: Instant
    Troubleshooter (August, 2003)
    >>>>> Technical Editor: DMX 2004: The Complete
    Reference, DMX 2004: A
    >>>>> Beginner's
    >>>>> Guide, Mastering Macromedia Contribute
    >>>>> Technical Reviewer: Dynamic Dreamweaver
    MX/DMX: Advanced PHP Web
    >>>>> Development
    >>>>>
    >>>>>
    >>>>> "tradmusic.com"
    <[email protected]> wrote in message
    >>>>>
    news:[email protected]...
    >>>>>> Hi,
    >>>>>>
    >>>>>> Two tables. Orders (orderID = PK)
    and Paid Orders (orderID = FK)
    >>>>>> I want to display a recordset of
    orders from the Orders table where
    >>>>>> the order ID doesn't appear in the
    Paid Orders table.
    >>>>>>
    >>>>>> I have tried something like this:
    >>>>>>
    >>>>>> SELECT *
    >>>>>> FROM dbo.tblOrders
    >>>>>> WHERE orderID NOT IN ( SELECT TOP
    100 PERCENT tblPaidOrders.orderID
    >>>>>> FROM dbo.tblPaidOrders )
    >>>>>>
    >>>>>> ...no joy with that though. Would
    appreciate some guidance. Thank
    >>>>>> you.
    >>>>>>
    >>>>>> Regards
    >>>>>> Nath.
    >>>>>>
    >>>>>
    >>>>>
    >>>>
    >>>>
    >>>
    >>>
    >>
    >>
    >
    >

  • Is it possible to ... SELECT * FROM my_table WHERE ssn IN (..arraylist..) ?

    Hi, I have a quick question I hope someone can help me with. I'm a student and what I'm looking for should be easy but I can't find any information on it.
    Here's my code, it's probably self-explanatory but to clarify I'm trying to get a list of "Captains" in the order of who has the most wins.
    The problem is that the database tables have thousands of "Captains" and I'm only supposed to look at 200 specific "Captains" which have their ssn in a specific arraylist and then return the top 80 "Captains" from that selection.
    Something like this...
    SELECT first 80 E.name, L.ssn, COUNT(L.wins) as Wins
    FROM log L, employees E
    where type matches "[Captain]"
    and E.ssn = L.ssn
    and L.ssn IN (...arraylist...) // How do I loop through the arraylist but still return a list of the top 80 winners?
    group by E.name, L.ssn
    order by Wins desc;
    Should I start by taking the list of social security numbers from the arraylist and insert them into a temporary table and then use that temporary table to base my selection on?
    For example:
    int rows = 0;
    PreparedStatement ps = conn.prepareStatement("INSERT INTO TEMP captainsTemp (ssn) VALUES(?)");
    Iterator i = myArrayList.iterator();
    while (i.hasNext())
         // Set the variables
         for (int pos = 1; pos <= 63; pos++)
              String s = (String)i.next();
              ps.setString(pos,s);
         // insert a row
         rows += ps.execute();
    ...and then below that I could use
    "SELECT * FROM captains
    WHERE ssn IN (SELECT * FROM captainTemp)..."
    This looks like an ugly solution and I'm not sure if it works, sessionwise..
    Everything's written in Java and SQL.
    If you have any thoughts on this I would be most grateful.
    I should add that this is NOT a school assignment but something I'm trying to figure out for my work...
    Many thanks,
    sincerely,
    JT.

    hi,
    Ignore my previous response. Try out this one. It should help you.
    Lets take the example of EMP table (in Oracle's SCOTT Schema). The following is the description of the table.
    SQL> desc emp
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    SQL> select ename from emp;
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    JAMES
    FORD
    MILLER
    Say, the ArrayList contains 3 names CLARK,KING & MILLER. You want to loop through the ArrayList for the ENAME values.
    First construct a string like below from the ArrayList.
    "ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER'";
    Append this string to the normal SELECT Query
    Query :
    select ename from emp where ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER'
    Here you get the desired output & thats pretty fast because you just do it once !!!
    SQL> select ename from emp where ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER';
    ENAME
    CLARK
    KING
    MILLER
    you can extend this to your Query also.
    thanks,
    Sriram

  • Text is selected one or two lines away from where cursor is located

    I'm viewing a PDF in Adobe Digital Editions 4.0, and when I try to select text, it actually selects text 1-2 lines off from where the cursor (I-bar) is located.  This makes highlighting text extremely difficult.  The PDF was created in Acrobat from a .docx file.  I've also tried creating the PDF from MS Word for Mac 2011.  Same problem.
    If I try opening the very same PDF file in Adobe Reader, the cursor highlights text just fine.  If I open it in Preview, it works fine too.  Just won't work in Adobe Digital Editions.
    System:  Mac OS 10.10 Yosemite

    You say your Powerbook but your profile indicates a MacBook Pro. Sounds more like a hardware issue than anything else. Post over in the hardware forum area of the Mac you have.

  • SA 520 error every 10 seconds: sqlite3QueryResGet failed.Query:SELECT * FROM networkInterface WHERE interfaceName=\'bdg1\

    Hi all,
    On a SA 520 I got this error, every 10 seconds:
    sqlite3QueryResGet failed.Query:SELECT * FROM networkInterface WHERE interfaceName=\'bdg1\
    Internet access was very spoty and I couldn't reach the firewall administration on the LAN interface. Had to shutdown the appliance to get it working again.
    Firmware version is 2.1.7.1
    What could have happenend?
    With kind regards,
    Jeroen

    Hi, everything in the "Quick Reference" section should be commented out with ;
    You should change those settings further down in the php.ini file.
    Example:
    error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
    display_errors = Off
    Last edited by adrianx (2013-07-26 12:32:02)

  • Select * from viewname where 1 1 gives records back

    for one customer the following sql gives records back
    select * from viewname where 1&lt;&gt;1
    we asked the customer to send over the database to us but we can't reproduce this behaviour. We don't get any records. the problem is we don't have the same version of oracle they use 9.2.0.4 and we used 10.2.0.1. i can't download the 9i version anymore.
    Does anybody know of a bug in oracle which can cause such behaviour or a setting which can correct this?
    Edited by: BluShadow on 09-Aug-2012 10:06
    corrected the &lt;&gt; issue so it's visible. Please read {message:id=9360002} which describes this issue.

    951790 wrote:
    i suspect the customer would first want us to show that their version is the problem.It doesn't work like that. If your customer called Oracle Support and said... "we're experiencing problems and our database version is 9.2.0.4"... oracle would turn around and say "that version is no longer supported, please upgrade". If they insist on knowing that their version is the problem, then the answer is "yes, it's the problem, it has known bugs and newer versions are available that address thousands of issues since"
    Using a query with "where 1 &lt;&gt; 1" as a condition that is bringing back results, is clearly wrong. You have clearly shown that in other more recent versions of the database it is working ok, therefore you have already proven that there is a bug in the version they are using.
    They are suspecting our view has a design flaw. We have in our documentation stated requirements for our software are the 9 or 10 version of oracle or sql server. So for me there are a couple of possibilities:
    -we try to reproduce the query on their database on the same oracle database version as they are using - problem is we don't have this exact same version and oracle does not have this version for download on their site anymore or so it seemsThat's because it's no longer supported. Any good software house will keep on top of it's customers to ensure they are upgraded in line with Oracle's ability to support. So, partially, it's your companies fault for saying you support version 9, when clearly you can't.
    --i ask other more knowledgable people(hopefully this forum) who might know about such problems which might result in a correction in the customer oracle database configuration or know of a bug in the customers version which causes this behaviour.You'll be lucky to find people still using such an old version (you're talking a version that almost 10 years out of date). The best you can do is to log onto Oracle Support and search there for known issues... and the answer on those is likely to be a recommendation to patch or upgrade too.
    -we change the queries to these views so they won't try to give back any records on their serverHow will you know unless you are able to test them?

  • Retrieve optimize: select * from tb where mdate sysdate

    hi,
    i wrote a simple statement :
    select * from tb where mdate > sysdate;
    it takes long time to return resultset.
    when i use to_char() function,
    select * from tb where to_char(mdate,'yyyy-mm-dd') >
    to_char(sysdate,'yyyy-mm-dd');
    it runs faster.
    who can tell me why?
    thanks.

    Are you running each statement multiple times and averaging the results? If you run the date comparison once, then run the character comparison, it's likely that the data you want is already cached, so the secod statement may well return more quickly. If you average multiple runs, you can avoid this.
    Justin

  • Select * from tbl where product like ('abc','def','rgh');

    Hi Guys,
    My requirement is I need to filter by providing date value with some of the porduct details and prod_id may differ with product like
    prod_id product date
    01 abc 01/2012
    02 abc 02/2012
    03 def 03/2012
    How can we put multiple text conditions using LIKE operator in where clause of the sql query.
    if we use union to combine all the sql queries, how can we filter by entering date value.
    SQL>select * from tbl where product like ('abc','def','rgh');
    Please provide any ideas on the same.
    Thanks in advance!
    -LK

    select * from tab1 where regexp_like(product,'^abc|def|rgh');

  • How to achieve that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND n"

    How to achieve the SQL like that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND name = 'Will' " with BDB C-API
    The primary key in the primary database is 'age' ,and the secondary key in the secondary index is 'name' ,in a lot of examples ,there are all simple , but how to do that complex one.thx~

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • General veriable in (select * from cust where id in(:var))

    hi
    i deal with view object and i have this query
    SELECT * FROM customers
    WHERE customers.id IN (:val);
    but i want pass value for val =101,201,301
    how can i do it and what is the type of variable to input at the same time 1,2,3 and query filter ?
    thanks

    thank's for your replay
    i try make it string but do not success and i input the parameters from baking bean
    when i try with just one value like 101 that work
    but with "101,102" that do not work may be know like one variables
    its mean :val="101,102" and :val variable it is string type
    thank s

  • SELECT FROM tab WHERE co varname -PLEASE HELP

    Hi
    I am trying to use a select query where col1 > 3. Instead of 3 i HAVE to use a variable name . Im getting data type mismatch in criteria expression error when i use this code:
    String query ="SELECT * FROM MEMBERS WHERE M_ID > '" + myvar + "' ";
    Please note that i tried using myvar as a String, int and even as a long - all in vain - resulted in same error.
    What am i doing wrong in that piece of code please?
    THANKS LODES
    sabcarina

    ok thanks . like YOU said this worked:
    String query= "SELECT * FROM MEMBERS WHERE M_ID >" + myvar;
    So please i need to LEARN the need for single quotes in the SQL queries:
    What is it used for and why ? i mean i know it is for Strings but why do we need to enclose these varnames in single quotes?
    THANKS A MILLION
    sabcarina

  • SELECT * FROM TESTTABLE WHERE ID IN (?)

    Hi,
    I have a query (SELECT * FROM TESTTABLE WHERE ID IN (?)) and I want to pass in parameter a list of values (an array or something like that) to put in my condition IN.
    How can I do in java ? Is there something special in the PreparedStatement ? Or have I to use another statement ?
    Thanks

    Geoffrey,
    You can formulate the sql query in the java side, and IN clause demands the arguements separates by commas,
    So you can easily prepare that string by taking the values from the parameters and inserting into that String separated by commas.
    Its better to that that operation in the java part rather than in the procedure if you are only running this query in that Procedure.
    Thanks.
    Hi,
    I have a query (SELECT * FROM TESTTABLE WHERE ID IN (?)) and I want to pass in parameter a list of values (an array or something like that) to put in my condition IN.
    How can I do in java ? Is there something special in the PreparedStatement ? Or have I to use another statement ?
    Thanks

Maybe you are looking for

  • How do I access video in my shared folder from iMovie on my iPad?

    I shot video on my iPhone and put it in a shared folder on iCloud. I can access this video on my iPad in the Photo app in the shared folder but this video is not available in iMovie on the same iPad. How do I make this available? Thanks!

  • SAP HR Security_ Dump error after table maintenance (T77UA)

    Hi, In our project we have both general authorizations and structural authorizations. There are ESS, MSS and HR Roles maintained in PFCG transactions. Our approach of Role assignments (profiles) is for Users and not against positions. Hence table T77

  • DBMS_JAVA Permissions & Host Procedure Errors

    I have a package which calls a procedure "Host" (all source below) to execute a command. Everything was working fine, except I was't able to see the DBMS_output results. So, I tried to get the DBMS_Java.Set_output to working by playing with the dbms_

  • Getting error while configuring DbAdapter connection pool

    I have SOA Suite 11g (11.1.1.5.0) installed. I have created a Data Source (soademoDatabase) in WLS Admin console, as per instructions in Oracle Tutorial. Then I created a connection pool for DbAdapter. However when I tried to update the DbAdapter to

  • ALV Drag&Drop - Action before Drop

    Hi experts, short question: I have 2 ALVs with an implemented Drag 'n' Drop behavior. Now I want to check BEFORE i drop the element if this element will fit to the Drop-target. (Example: my element has the length of 10, now I want to check if I have