Can we have a query like

Hi friends,
I would like to know if this could be possible
we have some 20 business like bus_ind, bus_usa, bus_jap...
I have to do the below query each of the business
for bus_ind
SELECT COUNT(*)
FROM bus_ind
WHERE
workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
workid NOT IN (6,7) AND
NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
instead of having 20 such query i was trying to see if there is a possibility to have a table like
shytest
id, tbl
1 bus_ind
2 bus_jap
3 bus_usa
and a single query like
SELECT COUNT(*)
FROM (select tbl from shytest where id=1)
WHERE
workdate BETWEEN TO_DATE('01/01/2008','DD/MM/YYYY') AND TO_DATE('31/12/2008','DD/MM/YYYY') AND
workid NOT IN (6,7) AND
NOT EXISTS (SELECT 'X' FROM bus_ind WHERE somecol = workid);
Thanks
-vish

According to your requirnment there should be only one table for all the bussinesses with different partitions for all the bussiness.
For now you can also create one veiw for all the business.. & fire you all query on that
create or replace view business_view as
     select 'bus_ind' as business_loc, col1, col2, ... from bus_ind union all
     select 'bus_usa' as business_loc, col1, col2, ... from bus_usa union all
     ...Or you can also use Dynamic sql as all other are suggesting.
Regards
Singh

Similar Messages

  • CAn we write a query like this

    CAn we write a query like this?
    If not how can this be changed?
    select col1,col2,col3.col4
    from table 1
    where col1,col2 in(select col1,col2 from table2)

    Or it may be identical:
    SQL> CREATE TABLE t1 (c INT NOT NULL);
    Table created.
    SQL> CREATE TABLE t2 (c INT NOT NULL);
    Table created.
    SQL> INSERT ALL
      2  INTO t1 VALUES (rn)       
      3  INTO t2 VALUES (rn)
      4  SELECT rownum AS rn FROM user_tables WHERE rownum <= 15;
    30 rows created.
    SQL> BEGIN                                       
      2  DBMS_STATS.GATHER_TABLE_STATS(user,'T1');
      3  DBMS_STATS.GATHER_TABLE_STATS(user,'T2');
      4  END;
      5  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM t1
      2  WHERE  EXISTS
      3         ( SELECT 1 FROM t2 WHERE c = t1.c )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T2"."C"="T1"."C")
    SQL> SELECT * FROM t1
      2  WHERE  c IN
      3         ( SELECT c FROM t2 )
      4 
    SQL> @xplan
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |    15 |    90 |     5 |
    |*  1 |  HASH JOIN SEMI      |             |    15 |    90 |     5 |
    |   2 |   TABLE ACCESS FULL  | T1          |    15 |    45 |     2 |
    |   3 |   TABLE ACCESS FULL  | T2          |    15 |    45 |     2 |
    Predicate Information (identified by operation id):
       1 - access("T1"."C"="T2"."C")

  • Dear Gurus, Can i have SQL query to get Ar cash receipt appled lines details in R12

    Dear Gurus, Can i have SQL query to get Ar cash receipt appled lines details in R12

    I need to get ar and ap details from GL through xla.For ex: Reference1,reference2,reference3,reference4,reference 5, in 11i these column values are displayed in gl_je_lines where as in R12 we need to join xla tables with gl_sl_link_id and gl_sl_link_table
    Can someone provide query to get subledger details particularly ar and ap?.How are the AP & GL Journal Tables linked? [ID 1188714.1]
    R12 Mapping Between Subledger Tables, SLA and GL Tables [ID 871622.1]
    eTRM
    http://etrm.oracle.com/
    Thanks,
    Hussein

  • Can I have many sdo_joins in one SQL statement?

    Hi guys,
    Can I have a join like this.I do not want to have the normal sql joins, i would liek my query in spatial.But I have error missing expression.Anything wrong I am doing?
    select a.esa_code,b.esa_code,f.esa_code
    FROM TABLE (sdo_join('opel_exch','geoloc',
    'aus_esa','geoloc',
    'mask =ANYINTERACT'))c,
    (sdo_join('aus_dalpg','geoloc',
    'aus_esa','geoloc',
    'mask =ANYINTERACT'))d,
    opel_exch a ,
    aus_esa b,
    aus dalpg f
    where c.rowid1=a.rowid and c.rowid2=b.rowid
    and c.rowid1=b.rowid and d.rowid2=f.rowid
    order by a.esa_code;
    OPEL_EXCh=POINT
    AUS_ESA=POLY & MULTIPOLY
    AUS_DALPG =POLY

    This could be due to the missing TABLE function on the second SDO_JOIN

  • Can we customise the query

    Hi,
    I have a query like this
    SELECT
    POBJ.NAME as Object_Name,
    TAS.NAME as phase_name
    FROM
    PROJECTS PRO,
    PROJECT_OBJECTS POBJ,
    TASKS TAS
    WHERE
    PRO.ID = POBJ.PRO_ID AND
    PRO.ID = TAS.PRO_ID AND
    TAS.NAME IN ('Build','Design','Testing','Test') AND
    PRO.ID = 2953
    Here each object has 4 phases displayed i want to dispay some thing like this
    object-1 Build,Design,Testing,Test
    object-2 Build,Design,Testing,Test
    now the reports is getting generatied like this
    object-1 Build
    object-1 Design
    object-1 Testing
    object-1 Test
    object-2 Build
    object-2 Design
    object-2 Testing
    object-2 Test
    can we do it like this any modification in the report
    thanks
    Sudhir

    I have a another requirement in the above query i defined phase names where that was the condition to display the data normally phase name will vary from object to object if u dont include the condition of build, testing, design will i be able to get all the phase names that are associated to object,
    now its like max(condition) we are alter
    i tryed altering like this
    SELECT
    POBJ.NAME,
    MAX(TAS.NAME)
    FROM
    PROJECTS PRO,
    PROJECT_OBJECTS POBJ,
    TASKS TAS
    WHERE
    PRO.ID = POBJ.PRO_ID AND
    PRO.ID = TAS.PRO_ID AND
    PRO.ID = 2673
    GROUP BY POBJ.NAME
    I GET ONLY THE LAST PHASE GETTING DISPLAYED THERE ARE MANY PHASES THAT ARE ASSOCIATED TO OBJECT
    how to modify
    thanks
    Sudhir

  • Hihaving a query like that who has done the Transport? How can i trace who

    having a query like that who has done the Transport? How can i trace who has done the transport (Import).
    I have tried with following steps but unable to find the right person.
    1. Go to TMS and disply the appropriate queue.
    2. Select menu path: Goto>Import History.
    3. Select menu path: Edit> Dipaly More.
    4. This will give the the "User" column.
    But my problem is the transport has happened long back. is there any other way to find out old import request who has done the transport.
    Please someone help me out on this.

    Do this may it can help you.
    At the last step where you had given "diaplay more"
    do this inspite of that:
    Extras --> Personal Settings
    Check the option "Query Interval Time" and try again.
    Best of luck !!!

  • Hi it's me rabia and i'm apple user  I want to change my cell phone because it's having scratches on it and i also feel like its home button did't work correctly  So i want to know that can i have a new cell phone on replace of this one at any nearby of m

    Hi it's me rabia and i'm apple user
    I want to change my cell phone because it's having scratches on it and i also feel like its home button did't work correctly
    So i want to know that can i have a new cell phone on replace of this one at any nearby of my house App store without any cost  ?
    But i'm not having any line yet on my phone i use it on net mostly so what is the scene can i have or can't ??
    please inform me soon !

    Is your phone still covered by warranty?  If so, go to your nearest Apple store and depending on what happened, this may or may not be covered by warranty.  If it is, then you can get a replacement exactly as the phone you already have.
    If out of warranty, then there is nothing you can do and you'll have to pay.

  • I have a Macbook Air that had some coffee spilled on the keyboard and as a result the plus/equals key is no longer functioning. Can I use a program like Ukelele to reprogram a different key to be my plus/equals key? Can I program a function key? key

    I have a Macbook Air that had some coffee spilled on the keyboard and as a result the plus/equals key is no longer functioning. Can I use a program like Ukelele to re-program another key to do that function? Can I re-program a function key to do this function?

    Water + electronics do not mix.  Something was damaged insode, and the logic board may be corroding as is.
    Take it to a Genius Bar for an evaluation and repair estimate.
    This is accidental damage and not covered by warranty.

  • In R12 can we have approval based on rules like Cost Cente or Account?

    Hi All,
    -In R12 GL can we have approval based on rules like Cost Centers or Account. I know a rule based on Amount can be setup
    -In R12 GL can we use the PO hierarchy and its Rules
    Thanks.

    Dear Srinivasan Muthu,
    Assuming that Red,Blue and white are the values for the chracteristic say Colour and if this assigned to
    a class type say 023 batch,while uploading the stock,the system asks the chracteristic value.
    Say suppose if you are entering 561in MB1C or 101 movement in MIGO for that material and if you
    select for Blue,then in MMBE you can click on the stock quantity and right click-->batch classification.
    The system shows for Blue colour.
    check and revert back.
    Regards
    Mangalraj.S

  • Can I have more than one Apple ID on my Apple TV iTunes? I'd like to combine my family members music on our Apple tv.

    Can I have more than one Apple ID on my Apple TV iTunes? I'd like to combine my family members music on our Apple tv.

    Maybe.
    See Family Sharing @ http://www.apple.com/ios/ios8/.

  • I'm a school tech coordinator. Many computers and many iPads. How many Apple IDs can I have per device, and how many devices can have the same Apple ID? To make my life easier, I'd like 200 devices to all use the same Apple ID.

    I'm a school tech coordinator. I have many computers and many iPads. I apologize if there is a some place that has all the rules governing the use of Apple IDs. I looked, and I even tried to get the answers from multiple Apple rep's. I couldn't find the answers.
    How many Apple IDs can I have per device?
    I want to use the same computer to sync and backup many iOS devices. The iOS devices would be associated with different Apple IDs.
    I may load apps under a school Apple ID and have users load their own apps under thier own ID.
    How many devices can have the same Apple ID?
    Can I use the same Apple ID on all the computers in a lab?
    Can I use the same Apple ID on all iPads for a particular grade level?
    Are the rules different for iOS devices and computers?
    I know that there are limits on "authorize" and "de-authorize" and how frequently those things can be done.
    Recently I heard that for the life of an iOS device, it can only be associated with five Apple IDs. That is not good for a school giving iPads to students in a 1:1
    To make my life easier, I'd like 200 devices to all use the same Apple ID.

    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html
    It would be best to address your questions there, especially since this is a public forum, and over there you could post more private issues with this set-up. Not to mention, getting more official answers.

  • I have an ipod touch but i don't have enough memory and 0I get an upgrade soon for my phone and i want the iphone but the thing is, can i have an ipod touch and an iphone on the same itunes account like can i use my money on my ipod account for my iphone

    I have an ipod touch but i don't have enough memory and 0I get an upgrade soon for my phone and i want the iphone but the thing is, can i have an ipod touch and an iphone on the same itunes account like can i use my money on my ipod account for my iphone

    Your iPhone and iPod can share the same iTunes account.  Apps can be freely shared and used by one or both devices.  You can't use money in your iTunes account to pay for your phone, but purchased apps can be used by both the iPod and iPhone.

  • HT5622 I'm a student exchange from france in USA, I have an apple ID from france and a bank count in france but i want access to the apple store US because I'm here for the year and some app can be interesting for me (like my gym club app) how can i do ?

    I'm a student exchange from france in USA, I have an apple ID from france and a bank count in france but i want access to the apple store US because I'm here for the year and some app can be interesting for me (like my gym club app) how can i do ?

    you cant.  you need a US bank account.

  • Can we have a Signature in the Adobe Send? also can it remember our passed email recipients address like SendNow did?

    Can we have a Signature in the Adobe Send? also can it remember our passed email recipients address like SendNow did?

    Hi there,
    In terms of the KB.
    You are probably looking at the old one.
    New one:
    http://helpx.adobe.com/business-catalyst/kb/modules-quick-reference.html
    Have you checked out the guide section and faq section on these forums as well? Lots of cool stuff.
    There is no Wishlist as there are other things a bit more tight in place where experienced partners work with BC on stuff for everyone. While the Amazon migration is taking a lot of man power out of BC development at the moment this was already seeing great and right features rolling out for all.
    Support has gone through a lot of changes and had a bad patch but the ticket system is on an all new system and I BC had a big jump so they had to hire a lot of new people, and it was rough for a while but I think this has improved a lot and continues to prove as the support team gain more experience. You can only be good at a support job once you learn the system and get more experience. That can only happen with time.
    In terms of problems and issues etc - You have the system status page, of which you can also subscribe too for updates via RSS and email:
    http://status.businesscatalyst.com/
    And the Blog is ALWAYS updated of the latest happenings. Big things like the Migrations partners have been getting emails and you will have seen this come through.
    You also need to check the forums as well as a lot of things are covered more then once on here, If you have an issue make a ticket but it is likely BC already know and other partners have already passed it on.
    Good to have feedback here and the team will defiantly take your points on board I am sure, but I just wanted to cover things as well, as often people just dont know things exist or dont check the right places for information saying there is none when BC defiantly does put the information out there.

  • How can i have my tasks in order by date like outlook on my iphone 4

    how can i have my tasks in order by date like outlook on my iphone 4

    Use a task management app that sorts by date? There are lots of options in the App Store.

Maybe you are looking for

  • Dunning Wizard - Adding customers not working

    Hi all, We're trying to run the dunning wizard, but are unable to add customers in step three. There are no error messages. The BP Properties dialogue box appears when the 'Add' button is clicked, we can select customers , but when 'OK' is clicked, n

  • Is there any way to get around startup login?

    I recently resurrected a crashed G4 hard drive by connecting it to another computer in target mode, and fixing the hard drive with Disk Utility. However, when I then restarted the G4, I was asked for a username and password, even though I've never ha

  • MapViewer Ver11_1_1_7_2 - Simple Geom Viewer and Setting up Streaming

    I am trying to use the simple geom viewer in map viewer and am getting the error below locally. I figure it is a problem with the datasource since the query has a geometry column. I did a ping in glassfish and it returned successfully. I am seeing an

  • Several operation in one machine

    Dear All, my clile requirement is they have one machine they produce several things for example there is mixing machine where they mix chocolate, nuts, biscuits, etc many things in one machine with different capacity how can i map this scenario in sa

  • Unknown software error while downloading Adobe Reader XI

    Adobe Reader XI stopped working.  Just before it stopped, it started opening with greatly magnified text.  Than it stopped working.   I tried to uninstall and reload.  I could not download from the Internet and got this error message "The exception u