Select .. Where sth IN what datatype?

Hi,
What kind of type fits to SELECT .. WHERE sth IN <.....?....> ? I need to put there a coulmn of numbers, I've tried:
Select * from some_table t
where t.id in
(Select column_value from Table(my_defined_table_of_numbers) )
but it seems to be extremely slow comparing with simple:
Select * from some_table t where t.id in (select id from other_table)
Regards,
BartlomiejD

You are right! When I've tried:
Select * from some_table t
where t.id in
(Select column_value from Table(my_defined_table_of_numbers)
WHERE ROWNUM < 1000000.. <doesn't matter how big number is)
it runs with optimal plan! (I will test varrays later, I think the clue is limitation).
Anyway- back to the first question: is there specialized type I can define and put later in WHERE..IN statement?
i.e.:
my_var my_unknown_type;
begin
my_var := ...
select * from my_table a where a.id in (my_var);
Regards,
BartlomiejD

Similar Messages

  • Where i can find datatypes?

    what table can i find all of all db DATA TYPES
    in system table or dba table or something...

    user619226 wrote:
    nono... i just want to see what datatypes it is posible to use in the db...
    it must show all datatypesWell, there is no (or at least I am not aware of it) SQL data type lookup. However, All_tab_columns is almost a indirect hit. Try ALL/DBA/USER_TAB_COLS view. View definition to be precise. Look at DECODE that provides value of DATA_TYPE column. It will provide the list:
    SQL> set long 10000
    SQL> select text from dba_views where view_name = 'USER_TAB_COLS';
    TEXT
    select o.name,
           c.name,
           decode(c.type#, 1, decode(c.charsetform, 2, 'NVARCHAR2', 'VARCHAR2'),
                           2, decode(c.scale, null,
                                     decode(c.precision#, null, 'NUMBER', 'FLOAT'),
                                     'NUMBER'),
                           8, 'LONG',
                           9, decode(c.charsetform, 2, 'NCHAR VARYING', 'VARCHAR'),
                           12, 'DATE',
                           23, 'RAW', 24, 'LONG RAW',
                           58, nvl2(ac.synobj#, (select o.name from obj$ o
    TEXT
                                    where o.obj#=ac.synobj#), ot.name),
                           69, 'ROWID',
                           96, decode(c.charsetform, 2, 'NCHAR', 'CHAR'),
                           100, 'BINARY_FLOAT',
                           101, 'BINARY_DOUBLE',
                           105, 'MLSLABEL',
                           106, 'MLSLABEL',
                           111, nvl2(ac.synobj#, (select o.name from obj$ o
                                     where o.obj#=ac.synobj#), ot.name),
                           112, decode(c.charsetform, 2, 'NCLOB', 'CLOB'),
                           113, 'BLOB', 114, 'BFILE', 115, 'CFILE',
    TEXT
                           121, nvl2(ac.synobj#, (select o.name from obj$ o
                                     where o.obj#=ac.synobj#), ot.name),
                           122, nvl2(ac.synobj#, (select o.name from obj$ o
                                     where o.obj#=ac.synobj#), ot.name),
                           123, nvl2(ac.synobj#, (select o.name from obj$ o
                                     where o.obj#=ac.synobj#), ot.name),
                           178, 'TIME(' ||c.scale|| ')',
                           179, 'TIME(' ||c.scale|| ')' || ' WITH TIME ZONE',
                           180, 'TIMESTAMP(' ||c.scale|| ')',
                           181, 'TIMESTAMP(' ||c.scale|| ')' || ' WITH TIME ZONE',
                           231, 'TIMESTAMP(' ||c.scale|| ')' || ' WITH LOCAL TIME ZO
    TEXT
    NE',
                           182, 'INTERVAL YEAR(' ||c.precision#||') TO MONTH',
                           183, 'INTERVAL DAY(' ||c.precision#||') TO SECOND(' ||
                                 c.scale || ')',
                           208, 'UROWID',
                           'UNDEFINED'),
           decode(c.type#, 111, 'REF'),
           nvl2(ac.synobj#, (select u.name from user$ u, obj$ o
                where o.owner#=u.user# and o.obj#=ac.synobj#), ut.name),
           c.length, c.precision#, c.scale,
           decode(sign(c.null$),-1,'D', 0, 'Y', 'N'),
    TEXT
           decode(c.col#, 0, to_number(null), c.col#), c.deflength,
           c.default$, h.distcnt, h.lowval, h.hival, h.density, h.null_cnt,
           case when nvl(h.distcnt,0) = 0 then h.distcnt
                when h.row_cnt = 0 then 1
                when (h.bucket_cnt > 255
                      or
                      (h.bucket_cnt > h.distcnt
                       and h.row_cnt = h.distcnt
                       and h.density*h.bucket_cnt*2 <= 1))
                    then h.row_cnt
                else h.bucket_cnt
    TEXT
           end,
           h.timestamp#, h.sample_size,
           decode(c.charsetform, 1, 'CHAR_CS',
                                 2, 'NCHAR_CS',
                                 3, NLS_CHARSET_NAME(c.charsetid),
                                 4, 'ARG:'||c.charsetid),
           decode(c.charsetid, 0, to_number(NULL),
                               nls_charset_decl_len(c.length, c.charsetid)),
           decode(bitand(h.spare2, 2), 2, 'YES', 'NO'),
           decode(bitand(h.spare2, 1), 1, 'YES', 'NO'),
           h.avgcln,
    TEXT
           c.spare3,
           decode(c.type#, 1, decode(bitand(c.property, 8388608), 0, 'B', 'C'),
                          96, decode(bitand(c.property, 8388608), 0, 'B', 'C'),
                          null),
           decode(bitand(ac.flags, 128), 128, 'YES', 'NO'),
           decode(o.status, 1, decode(bitand(ac.flags, 256), 256, 'NO', 'YES'),
                            decode(bitand(ac.flags, 2), 2, 'NO',
                                   decode(bitand(ac.flags, 4), 4, 'NO',
                                          decode(bitand(ac.flags, 8), 8, 'NO',
                                                 'N/A')))),
           decode(c.property, 0, 'NO', decode(bitand(c.property, 32), 32, 'YES',
    TEXT
                                              'NO')),
           decode(c.property, 0, 'NO', decode(bitand(c.property, 8), 8, 'YES',
                                              'NO')),
           decode(c.segcol#, 0, to_number(null), c.segcol#), c.intcol#,
           case when nvl(h.row_cnt,0) = 0 then 'NONE'
                when (h.bucket_cnt > 255
                      or
                      (h.bucket_cnt > h.distcnt and h.row_cnt = h.distcnt
                       and h.density*h.bucket_cnt*2 <= 1))
                    then 'FREQUENCY'
                else 'HEIGHT BALANCED'
    TEXT
           end,
           decode(bitand(c.property, 1024), 1024,
                  (select decode(bitand(cl.property, 1), 1, rc.name, cl.name)
                   from sys.col$ cl, attrcol$ rc where cl.intcol# = c.intcol#-1
                   and cl.obj# = c.obj# and c.obj# = rc.obj#(+) and
                   cl.intcol# = rc.intcol#(+)),
                  decode(bitand(c.property, 1), 0, c.name,
                         (select tc.name from sys.attrcol$ tc
                          where c.obj# = tc.obj# and c.intcol# = tc.intcol#)))
    from sys.col$ c, sys.obj$ o, sys.hist_head$ h, sys.coltype$ ac, sys.obj$ ot,
         sys.user$ ut
    TEXT
    where o.obj# = c.obj#
      and o.owner# = userenv('SCHEMAID')
      and c.obj# = h.obj#(+) and c.intcol# = h.intcol#(+)
      and c.obj# = ac.obj#(+) and c.intcol# = ac.intcol#(+)
      and ac.toid = ot.oid$(+)
      and ot.type#(+) = 13
      and ot.owner# = ut.user#(+)
      and (o.type# in (3, 4)                                    /* cluster, view */
           or
           (o.type# = 2    /* tables, excluding iot - overflow and nested tables */
            and
    TEXT
            not exists (select null
                          from sys.tab$ t
                         where t.obj# = o.obj#
                           and (bitand(t.property, 512) = 512 or
                                bitand(t.property, 8192) = 8192))))
    SQL> SY.

  • Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?

    Drop down menus on iPad, the first selection in the drop down will not load as a selection when using safari, what can I do?  I use this for my mobile, on-site auto repair business and not being able to call up repair and diagnostic info and reference for some cars is troublesome for sure. It works fine on the computer and I have installed a remote desktop app as a workaround but it is unreliable because the desktop is not business dedicated and may be off or in use at the time. So is there a known fix for this?
    Let me paint a more descriptive picture, visualize 4 drop down selection menus, first one is for year, next one is for make, 3rd one is model and the last one is for engine size/type. If I wanted to choose a 2012 vehicle it wont work because it is the top selection on the list. This can be forced by selecting any other year and then coming back to 2012. Ok fine, but then let's say I wanted to choose Acura as the make, well it won't take it because again it's the top selection. Again you work around it be selecting any other make and coming back to Acura. Ok now select the model, same trend follows. But now since most Acura vehicles come with dedicated engines and no optional engines I have only 1 selection in that final drop down menu and it will not take my selection and therefore never let me proceed to the info I need.
    This is also true when ordering parts from my wholesaler's website, they use drop downs and I can only get to that last drop down and then I'm stuck. This is blindingly frustrating, what options do I have. I'm not opposed to any avenue at this point.

    Did you ever figure this out? I bought my iPad last week to use in my business as well. I assume you are trying to use alldata? That is where I noticed this same issue. I had problems with identifix working with safari but downloaded a different browser and that works fine. Alldata does not work with either browser. The main difference is that on identifix if there is only one engine selection, it automatically selects the only option and continues to the home page. With alldata you have to make the selection manually even if there is only one option. Honestly if I can't get this to work I am going to return the iPad as it looses a significant amount of usefulness to men

  • How do you keep the order using SELECT WHERE IN()?

    Hi,
    Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:
    SELECT id FROM data_table WHERE id IN('56','55','54','1','7');
    The results will come back using the default order by id. 1,7,54,55,56
    When I want to keep the order used in the IN: 56,55,54,1,7
    Is there a quick way to do this in mySQL or will I be forced to order it after in code.
    Thanks

    797836 wrote:
    Hi,
    Is there a way to keep the order when using SELECT WHERE IN()? For example, using the following query:
    SELECT id FROM data_table WHERE id IN('56','55','54','1','7');
    The results will come back using the default order by id. 1,7,54,55,56In case the order by docs and comments weren't clear on this point, there is no default order and they may come back in a different order. Usually after you've tested it to exhaustion to prove otherwise, then put it in production.
    >
    When I want to keep the order used in the IN: 56,55,54,1,7
    Is there a quick way to do this in mySQL or will I be forced to order it after in code.
    ThanksUsing the in list allows oracle to have other possible data access paths than simply running the query 5 times. If for whatever reason you don't want to order the results after they come back, it may be worth your while to just run the five queries serially in the order you want, using bind variables and so having identical queries. That may seem silly on its face, but then again, we don't know the real requirements, what else is going on, if this is simplified from the real code or whether there will always be 5.

  • What datatype field do I have to define for a 2^400 number??????

    I need to store a number in a table field. The maximum number is: 2^400.
    I would want to put in the field a Number datatype but the max. is NUMBER(38)
    What datatype field do I have to define for a 2^400 number??????
    Thanks in advance!!!

    Will a float work for you, or do you need every digit?
    SQL> create table t (n number);
    Table created.
    SQL>
    SQL> insert into t(n)
      2  select power(2,400)
      3  from dual;
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t;
             N
    2.582E+120

  • Select where date current_date

    Hi, all
    I just tried to play with that select where I need to pick up records with TRADEDATE < 'CURRENT-DATE' and really impressed how intuituve Oracle is.
    tradedate date;
    SELECT * FROM TRADEMIX WHERE TRADEDATE <= (SELECT CURRENT_DATE FROM DUAL); works just fine, I see that even Month displayed as char 'SEP' treated in right collating order. Wow !!!
    So looks I don't need to do anything special ? It's my first experience with Oracle, so I just want to confirm that it's really the case.
    Also what will be the best way to do select only for TRADEDATE = ' 2010' (all records for give year)? Do I need to do any to_char for that? Not sure about correct syntax, all sample in texbook noted the whole date string 'DD-MON-YY'.
    Thanks
    Trent

    trento wrote:
    Hi, all
    I just tried to play with that select where I need to pick up records with TRADEDATE < 'CURRENT-DATE' and really impressed how intuituve Oracle is.
    tradedate date;
    SELECT * FROM TRADEMIX WHERE TRADEDATE <= (SELECT CURRENT_DATE FROM DUAL); works just fine, I see that even Month displayed as char 'SEP' treated in right collating order. Wow !!!
    So looks I don't need to do anything special ? It's my first experience with Oracle, so I just want to confirm that it's really the case.
    Also what will be the best way to do select only for TRADEDATE = ' 2010' (all records for give year)? Do I need to do any to_char for that? Not sure about correct syntax, all sample in texbook noted the whole date string 'DD-MON-YY'.
    Thanks
    TrentYou have some other examples for dealing with a just the year component of dates, but let me also point out a simpler form of what you have here:
    select * from trademix where tradedate <= sysdate;Just reference SYSDATE. No need to do a subselect against dual.
    And keep these things in mind:
    Oracle always stores DATE data in its internal format. That format includes both date and time.
    NSL_DATE_FORMAT, and the TO_DATE and TO_CHAR functions only deal with the presentation of the date.
    Play with this:
    alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='dd-mon-yyyy hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='yyyy-Mon-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='yyyy-MON-dd hh24:mi:ss';
    select sysdate from dual;
    alter session set nls_date_format='mm-dd-yyyy';
    select sysdate from dual;
    select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
    select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss') from dual;
    select to_char(sysdate,'yyyy-Mon-dd hh24:mi:ss') from dual;Also keep firmly in mind that a character string is just that - a character string. No matter how much it may look like a date to you. Your keyboard is only capable of generating character strings. Your monitor is only capable of displaying character strings.

  • Dissapeared footer (where is written what page is loading and so on) how to restore it?

    Dissapeared footer (where is written what page is loading and so on) how to restore it?
    there is the screenshot ( http://j.imagehost.org/0213/Clipboard03.jpg )

    View > Statusbar = click it

  • What datatype should i use to store imaq image in sql database?

    Hi there i am thinking of saving the imaq image into database for retrieval in my website so that it's like a stream but i don't like what datatype does labview store the image as.

    You have two options for storing images in a relational database:
    A.  Don't put it in a database.  Store it as a file, and store the pointer int he DB (as mentioned above).
    B.  Store it as a blob datatype.  See here for more info.

  • What Datatype Should I Use to Change the "lockoutTime" attribute using JNDI

    I am able to use JNDI to modify an object's String valued attributes in ADAM.
    However, now I want to modify lockoutTime which has a datatype of LargeInteger/interval
    According to the documentation for AD, I can set the lockoutTime as:
    new BasicAttribute("lockoutTime", Integer.toString(0)));But with ADAM this throws the exception:
    [LDAP: error code 53 - 00000057: LdapErr: DSID-0C090A4C, comment: Error in attribute conversion operation, data 0, vece_What datatype do you suggest I use, to set lockoutTime to 0 using java/JNDI?
    What datatype does LargeInteger/interval map to in java?

    As both are equivalent to "0" it is impossible to believe that that solved your problem.

  • How do I get iPhoto on new iPad to load all Facebook albums to select where to upload?

    How do I get iPhoto on new iPad to load all Facebook albums to select where to upload?
    Besides 'new album' , 'wall photos', or 'iPhoto Uploads' ... it only shows 24 pre-existing albums to choose. I need to see the other 50, 60, etc albums I have.
    I've also noticed that iPhoto fails to load to certain albums with some 'Domin Exception' error of some kind (not sure the exact message).

    You need to make the new Mac iTunes library your syncing library. iTunes on the Mac sees your iPad as a new device because you have never synced with this computer before. You can make the Mac your syncing computer by following the instructions in this user tip. You will be able to transfer the purchased music on the iPad into iTunes when you follow this procedure.
    Syncing to a new computer.
    https://discussions.apple.com/docs/DOC-3141

  • After loading the new OS now my songs do not play correctly. Titles are wrong on songs and it just doesn't play certain songs in random play or even if you select them individually. What's up? Kind of frustrating!!!

    After loading the new OS my songs do not play correctly, is anyone else having this issue? Titles are wrong on songs and it just doesn’t play certain songs in random play or even if you select them individually. What’s up? Kind of frustrating!!!

    I had the same issue.  In fact I posted it yesterday, but didn't get any replies.  I physically synched my phone to PC iTunes.  on the PC, under the phone/music tab, I unchecked the synch music box and then the apply button to remove all of the music from my phone.  Then once that synch finished, I went back and selected all music, and synch music and apply to put it back on to the phone.  So far, I haven't had an issue again, but I also haven't listened very long.  Hope this helps!

  • Select where Ken Burns into?

    On Windows Movie Maker, I could select the location where the KBE would zoom into. As far as I can tell, iMovie does it automagically. Is there a way to select where to apply the KBE (not on/off or zoom in/out)?
    Thanks

    Also, click on the rectangle to toggle between the red rectangle and the green rectangle.

  • My brother locked his mac with Icloud, but there is no apple store where he lives. what he can do?

    my brother locked his mac with Icloud, but there is no apple store where he lives. what he can do?

    He will have to go to an Apple Store or an Apple-authorised repair centre, and he will need the invoice for the Mac so that he can prove it's his.

  • Hi on my macbook i want to Erase and reinstall os x lion i know you have to select Disk Utility it says select start up disk what disk would that be

    hi on my macbook i want to Erase and reinstall os x lion i know you have to select Disk Utility it says select start up disk what disk would that be macintosh HD to erase would someone help us out

    It will be the one on top of the list.  In this example it is BARBAROSSA:
    Ciao.
    The name should be the same as the HDD icon on your desktop, usually Macintosh Hard Drive.
    Message was edited by: OGELTHORPE

  • I have a 2011 Kia Sorento with hands free bluetooth.  I can select where the music can be played, to the Sorento, but the music does not come through the bluetooth speakers in the Sorento.  Am I missing an app for that?  What am I doing wrong?

    I have trying to connect my iTunes music through my bluetooth in my Kia Sorento.  I have paired the phone with the bluetooth, but now the phone will not even connect, let along having the music play through.  Do I need a special app for that?  Was something dropped or lost from my iPhone to where no connection, phone or music, will play through the bluetooth to the speakers in the car? 

    It should work just fine. Try deleting the pairing in the car and on the phone, then re-pair them. It works fine in my 2011 Optima (with the non-nav system) after upgrading to iOS 5.
    Make sure there is no other bluetooth connection active when you start the car to connect to it (like a headset).

Maybe you are looking for