SQL : Urgent pls

Hi
Can we use ORDER BY Clause in a Query using set operators like UNION, UNION ALL, INTERSECT and MINUS?
When I tried to join tables using UNION with order by clause in both the queries, I get this error ....
SQL command not properly ended.
But the same, when I execute without order by clause in both the queries it's working fine!
Can any one tell me wether its possible to use order by in a query using set operators(UNION)?
Thnaks in Advance.

While using union , an ORDER BY clause can be specified only after the last select block. The ordering is performed on the entire final result.
select a,b,c
from     x
union
select a,b,c
from y
order by b

Similar Messages

  • I need one recurcive(unended loop) pl/sql example, its very urgent pls

    Hi,
    I need one recurcive (unended loop) pl/sql example, its very urgent pls
    Thanks,
    Sathis.

    I suppose you'll want to know how to get out of your undended loop too (although that does stop it being unended).
    Example...
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    v_cnt NUMBER := 0;
      3  BEGIN
      4    LOOP
      5      EXIT WHEN v_cnt = 1000;
      6      v_cnt := v_cnt + 1;
      7    END LOOP;
      8* END;
    SQL> /
    PL/SQL procedure successfully completed.
    SQL>

  • I have a MacBook Pro 13.3 OS- MAC OS X LION.Whenever I am staring the computer, it says You need to restart your computer by pressing the power button.I did this number of times and everytime it freezes to the same screen.Solution needed urgently pls.

    I have a MacBook Pro 13.3 OS- MAC OS X LION.
    Whenever I am staring the computer, it says You need to restart your computer by pressing the power button.
    I did this number of times and everytime it freezes to the same screen.Solution needed urgently pls.
    Thank you for any help in this regard that comes fast.

    The details of the kernel-panic report is as follows-
    Interval Since Last Panic Report:  1458653 sec
    Panics Since Last Report:          6
    Anonymous UUID:                    70BA6A**************************************************
    Sun Sep 16 23:00:13 2012
    panic(cpu 0 caller 0xffffff80002c4794): Kernel trap at 0xffffff8000290560, type 14=page fault, registers:
    CR0: 0x0000000080010033, CR2: 0x0000000000800028, CR3: 0x000000000a509005, CR4: 0x00000000001606e0
    RAX: 0x0000000000000001, RBX: 0x0000000000820000, RCX: 0xffffff801122dc40, RDX: 0x0000000000020501
    RSP: 0xffffff80ef3d3da0, RBP: 0xffffff80ef3d3dc0, RSI: 0x000000002b1d78b6, RDI: 0xffffff800342d280
    R8:  0xffffff80ef3d3f08, R9:  0xffffff80ef3d3ef8, R10: 0x000000010d901000, R11: 0x0000000000000206
    R12: 0xffffff800342d280, R13: 0x0000000000000000, R14: 0xffffff8011cd6500, R15: 0x0000000000800000
    RFL: 0x0000000000010206, RIP: 0xffffff8000290560, CS:  0x0000000000000008, SS:  0x0000000000000000
    CR2: 0x0000000000800028, Error code: 0x0000000000000000, Faulting CPU: 0x0
    Backtrace (CPU 0), Frame : Return Address
    0xffffff80ef3d3a50 : 0xffffff8000220792
    0xffffff80ef3d3ad0 : 0xffffff80002c4794
    0xffffff80ef3d3c80 : 0xffffff80002da55d
    0xffffff80ef3d3ca0 : 0xffffff8000290560
    0xffffff80ef3d3dc0 : 0xffffff800026c9c3
    0xffffff80ef3d3f40 : 0xffffff80002c3fbb
    0xffffff80ef3d3fb0 : 0xffffff80002da481
    BSD process name corresponding to current thread: fsck_hfs
    Mac OS version:
    11E2620
    Kernel version:
    Darwin Kernel Version 11.4.2: Wed May 30 20:13:51 PDT 2012; root:xnu-1699.31.2~1/RELEASE_X86_64
    Kernel UUID: 25EC645A-8793-3201-8D0A-23EA280EC755
    System model name: MacBookPro9,2 (Mac-6F01561E16C75D06)
    System uptime in nanoseconds: 4850001132
    last loaded kext at 1796984176: com.apple.driver.BroadcomUSBBluetoothHCIController    4.0.7f2 (addr 0xffffff7f80e16000, size 57344)
    loaded kexts:
    com.apple.driver.BroadcomUSBBluetoothHCIController    4.0.7f2
    com.apple.driver.AppleUSBTCButtons    227.6
    com.apple.driver.AppleUSBTCKeyEventDriver    227.6
    com.apple.driver.AppleUSBTCKeyboard    227.6
    com.apple.driver.AppleIRController    312
    com.apple.AppleFSCompression.AppleFSCompressionTypeDataless    1.0.0d1
    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib    1.0.0d1
    com.apple.BootCache    33
    com.apple.iokit.SCSITaskUserClient    3.2.1
    com.apple.driver.XsanFilter    404
    com.apple.iokit.IOAHCISerialATAPI    2.0.3
    com.apple.iokit.IOAHCIBlockStorage    2.0.4
    com.apple.driver.AppleFWOHCI    4.8.9
    com.apple.driver.AirPort.Brcm4331    560.7.21
    com.apple.driver.AppleSDXC    1.2.2
    com.apple.driver.AppleUSBHub    5.0.8
    com.apple.iokit.AppleBCM5701Ethernet    3.2.4b8
    com.apple.driver.AppleEFINVRAM    1.6.1
    com.apple.driver.AppleSmartBatteryManager    161.0.0
    com.apple.driver.AppleAHCIPort    2.3.0
    com.apple.driver.AppleUSBEHCI    5.0.7
    com.apple.driver.AppleUSBXHCI    1.0.7
    com.apple.driver.AppleACPIButtons    1.5
    com.apple.driver.AppleRTC    1.5
    com.apple.driver.AppleHPET    1.7
    com.apple.driver.AppleSMBIOS    1.9
    com.apple.driver.AppleACPIEC    1.5
    com.apple.driver.AppleAPIC    1.6
    com.apple.driver.AppleIntelCPUPowerManagementClient    195.0.0
    com.apple.nke.applicationfirewall    3.2.30
    com.apple.security.quarantine    1.3
    com.apple.security.TMSafetyNet    8
    com.apple.driver.AppleIntelCPUPowerManagement    195.0.0
    com.apple.driver.AppleUSBBluetoothHCIController    4.0.7f2
    com.apple.iokit.IOBluetoothFamily    4.0.7f2
    com.apple.driver.AppleFileSystemDriver    13
    com.apple.driver.AppleUSBMultitouch    230.5
    com.apple.driver.AppleThunderboltDPInAdapter    1.8.4
    com.apple.driver.AppleThunderboltDPAdapterFamily    1.8.4
    com.apple.driver.AppleThunderboltPCIDownAdapter    1.2.5
    com.apple.iokit.IOUSBHIDDriver    5.0.0
    com.apple.driver.AppleUSBMergeNub    5.0.7
    com.apple.driver.AppleUSBComposite    5.0.0
    com.apple.iokit.IOSCSIMultimediaCommandsDevice    3.2.1
    com.apple.iokit.IOBDStorageFamily    1.7
    com.apple.iokit.IODVDStorageFamily    1.7.1
    com.apple.iokit.IOCDStorageFamily    1.7.1
    com.apple.driver.AppleThunderboltNHI    1.6.0
    com.apple.iokit.IOThunderboltFamily    2.0.3
    com.apple.iokit.IOSCSIArchitectureModelFamily    3.2.1
    com.apple.iokit.IOFireWireFamily    4.4.5
    com.apple.iokit.IO80211Family    420.3
    com.apple.iokit.IOEthernetAVBController    1.0.1b1
    com.apple.iokit.IONetworkingFamily    2.1
    com.apple.iokit.IOUSBUserClient    5.0.0
    com.apple.iokit.IOAHCIFamily    2.0.8
    com.apple.iokit.IOUSBFamily    5.0.8
    com.apple.driver.AppleEFIRuntime    1.6.1
    com.apple.iokit.IOHIDFamily    1.7.1
    com.apple.iokit.IOSMBusFamily    1.1
    com.apple.security.sandbox    177.5
    com.apple.kext.AppleMatch    1.0.0d1
    com.apple.driver.DiskImages    331.7
    com.apple.iokit.IOStorageFamily    1.7.2
    com.apple.driver.AppleKeyStore    28.18
    com.apple.driver.AppleACPIPlatform    1.5
    com.apple.iokit.IOPCIFamily    2.7
    com.apple.iokit.IOACPIFamily    1.4

  • Global_attribute20 field in ap_payment_schedules_all table - Urgent Pls

    All,
    Version: 11.5.10.2
    I created an invoice, from the 'Scheduled Payments' tab I checked the 'Hold' flag. After the flag is checked in the UI, I noticed the global_attribute20 field in the ap_payment_schedules_all updates to 'EP' along with the hold_flag='Y'. I want to know the significance of global_attribute20 and what are all the other possible values of this field like 'EP'??
    this is quite urgent, pls help.
    rgds
    sen

    Have you tried to enable trace on this form to find out how this column gets populated?
    FAQ: Common Tracing Techniques within the Oracle Applications 11i/R12 [ID 296559.1] -- 3. How does one enable trace in the Oracle Application screens / forms?
    Can you reproduce the issue with other invoices?
    Do you have any other instance where you can try the same and see if the issue is reproducible?
    Thanks,
    Hussein

  • Routine in Bex - urgent pls.

    I have 2 columns A and B in the report:
    A     B     C
    1234     1234     1234     
    5903     0     5903
    0     3287     3287
    I want to get the column C.
    So, the condition for the column C would be :
    if A<>0 and B <>0 then A
    else if A==0 then B
    else if B==0 then A
    I heared that this can be done by routines . I need the code to do this . Also let me know where to put the code.
    This is urgent pls.
    Vaishali

    Hi,
    No need to write coding.....directly u can get these by unsing formula as told in the above forum....there u get all these conditions in Boolean operators. so just make use of them..
    Thanks & Regards

  • Depreciation Posting in AFAB (urgent Pls)

    Hi All,
    pls let me know y the depreciation posting is not hapenning when it is showing Document created in Test run. It is not showing any errors nor is it posting. urgent pls.
    Chatura.

    Hi,
    Thanks for replying. It did not create any RABUSH Session .
    1) I created an Asset and gave the Depreciation Start date as     01.09.07.
    2) then i posted an entry in F-90 with transaction type 100, on     01.09.07.
    3) The periods are kept open only.
    4) The number Ranges for AF Document exists.
    5)i did an unplanned posting run for 1 to 8 periods. for 9th period i did the Repeat run . It generated an accounting entry with AF document type.
    6) now if i'm trying to do the test run for 10 th period it shows that the Document is created but in the repeat run it is neither posting the document nor is it showing the error.
    I was not able to analyse the reason.
    Pls help me out. Also pls let me know where to select the direct FI posting in asset accounting. Points will be awarded infull if the issue is solved.
    Regards,
    Chatura.

  • Its urgent pls help me .

    how can i call a portal from webdynpro application
    my requirment is
    i was created webdynpro application.
    in that i was created one view . in that i was created one button (go).
    if i click that button i want move some other portal.
    how can i acchive pls help me.
    its urgent.
    pls send any example programe
    Message was edited by:
            madipadiga nagaraju
    Message was edited by:
            madipadiga nagaraju

    hi,
    there is no direct tcode for going to webdynpro component/interfaces in ecc 6.0.
    but u have se58 in ecc 5.0,as webdynpro convertor.u give ur program name and click web dynpro convertor button then it takes u to se80 .but this wda(webdynpro abap) component comes as in application tree hierarchy .
    i can say in wda component refers a class .if u select webdynpro component/interface,it ask u to create a class or interface.
    after that it automatically generate component controller(it is also a class),
    interface view and windows.all these 3 are classes.for every window one interface view will be created.ie.. window is internal visible where as interface view is external visible.
    u create view and embed these views in windows.by going to the window layout,right click on the window name and click embed view.u can enbed as many view as u wish.in order to navigate from one view to other view ,click  "create navigation" by right clicking the view plugs.
    by default windows and view have inbound plugs.this is literally a event of that class.
    if u want to navigate from view1 to view2 ,create outbound plug for view1,the click outbound plug of view1 and right click the click create navigation the select inbound plug of view2.
    then create a application .this is simillar of creating an object.
    click on this object and test .this will open in browser.
    for deploying u have use "sap webdynpro iview".

  • Telnet connection---urgent pls

    each time i try to telnet using my LAPTOP.I get command not recognised.can somebody help me out now.Other PC works except mine.This is very urgent pls.

    Download Putty
    Search on google " Putty ".... using putty telnet.
    You can open Hyperterminal and choose TCP/IP option instead of COM1.
    Click on OK
    You will telnet into device.
    Putty use is very good very secure.
    Regards,
    Dharmesh Purohit

  • Need a SQL query(Pls Its urgent)

    Hi,
    I want a SQL query for the foll..
    Details r below..
    Table AFPFTRAN
    BU TRansactiondate Amt
    13202 10-04-05 10,000
    13203 11-05-05 20,000
    13202 20-04-05 5,000
    Table AFGENCOD
    BU Clerk Name Clerk Code
    13202 Amit TFBG
    13203 Anand TFMG
    I want a query to get data as below..
    Tr Date TFBG TFMG
    Apr 15,000 0
    May 0 20,000
    JUn 0 0
    Jul 0 0
    Aug
    Sep
    Aug
    Nov
    DEc
    Jan
    Feb
    Mar
    I want this to achieve using a single query...?How can I achive this?
    Pls give the sol...
    Adios...
    Prashanth Deshmukh

    Does it look like you need ?
    SQL> select * from t;
            BU TDATE           AMT
         13202 10.04.05      10000
         13203 11.05.05      20000
         13202 20.04.05       5000
    SQL> select * from t1;
            BU NAME  CODE
         13202 Amit  TFBG
         13203 Anand TFMG
    SQL> SELECT pivot_month.mname, tops.TFBG, tops.TFMG
      2  from
      3  (
      4  select to_char(t.tdate,'MM') month_no,
      5  sum(decode(t1.code,'TFBG',t.amt,0)) TFBG,
      6  sum(decode(t1.code,'TFMG',t.amt,0)) TFMG
      7  from t1, t
      8  where t.bu=t1.bu
      9  and to_char(t.tdate,'yyyy') = 2005
    10  GROUP BY t1.code, to_char(t.tdate,'MM')
    11  ) tops,
    12  (select rownum mn, to_char(to_date(rownum,'MM'),'MON') mname,
    13  case when rownum between 1 and 3 then rownum + 9
    14  else rownum - 3 end rn
    15  from dict where rownum < 13) pivot_month
    16  where pivot_month.mn = tops.month_no (+)
    17  order by pivot_month.rn
    18  /
    MNA       TFBG       TFMG
    APR      15000          0
    MAY          0      20000
    JUN
    JUL
    AUG
    SEP
    OCT
    NOV
    DEC
    JAN
    FEB
    MAR
    12 rows selected.Rgds.

  • How to join two pl/sql tables .,.,,Urgent pls help

    Hi,
    Please tell me how to join to pl/sql tables with example
    thanks
    asp

    If your main intention is to get the common records/or getting whole records from the 2 different pl/sql arrays then , pls check this piece of code & explanation
    The SQL language has long offered the ability to apply set operations (UNION, INTERSECT, and MINUS) to the result sets of queries. In Oracle Database 10g, you can now use those same high-level, very powerful operators against nested tables (and only nested tables) in your PL/SQL programs and on nested tables declared as columns inside relational tables.
    Let's take a look at some of the syntax needed to do this, starting with UNION.
    First, I create a schema-level nested table type:
    CREATE OR REPLACE TYPE strings_nt
    IS TABLE OF VARCHAR2(100);
    Then I define a package and within it create and populate two nested tables of this type, each containing some of my father's and my favorite things:
    CREATE OR REPLACE PACKAGE favorites_pkg
    IS
    my_favorites strings_nt
    := strings_nt ('CHOCOLATE'
    , 'BRUSSEL SPROUTS'
    , 'SPIDER ROLL'
    dad_favorites strings_nt
    := strings_nt ('PICKLED HERRING
    , 'POTATOES'
    , 'PASTRAMI'
    , 'CHOCOLATE'
    PROCEDURE show_favorites (
    title_in IN VARCHAR2
    , favs_in IN strings_nt
    END;
    In this package, I also include a procedure to show the contents of a strings_nt nested table. This will come in very handy shortly.
    By defining these collections in a package, outside any program, they persist (they maintain their state and values) for the duration of my session or until I change or delete them. This means that I can now write programs outside the package to manipulate the contents of those collections.
    Note that this package has been simplified for the purposes of presenting collection functionality. In a production application, you should always take care to "hide" your package data, as with these collections, in the package body, and then provide procedures and functions to manage the data.
    Suppose, for example, that I would like to combine these two collections into a single collection of our favorites. Prior to Oracle Database 10g, I would have to write a loop that transfers the contents of one collection to another. Now, I can rely on the MULTISET UNION operator, as shown below:
    DECLARE
    our_favorites
    strings_nt := strings_nt ();
    BEGIN
    our_favorites :=
    favorites_pkg.my_favorites
    MULTISET UNION ---- Use INTERSECT , if you want to know common records
    favorites_pkg.dad_favorites;
    favorites_pkg.show_favorites (
    'ME then DAD', our_favorites);
    END;
    The output from this script is:
    ME then DAD
    1 = CHOCOLATE
    2 = BRUSSEL SPROUTS
    3 = SPIDER ROLL
    4 = PICKLED HERRING
    5 = POTATOES
    6 = PASTRAMI
    7 = CHOCOLATE
    ------------------------------

  • Sql Loader problem.Urgent pls

    Hi experts.
    Now i am using Oracle 7.3 . i am want to know one thing in sql loader. is it possible to load data with out using one field. i want to divide and load into one field. I have given one example here. pls give me the logic how i can load like this.
    load data
    infile 'xxx.prn'
    append
    into table xyy
    PRC decimal external "to_number(position(191:197))/to_number(position(2
    05:211))"
    thanks in advance
    venkat

    Would you please stop posting the same question again and again?
    This is really boring.

  • T sql query urgent pls

    hi ,
    i have data like this
    cola colb colc
    123 12 a
    123 12  b
    123 12 a
    124 12  d
    124 12  f
    we have to loop throuhj all the values associated with colc for each cola and colb, if all the values are not in (a and b), then i return the distinct on cola  and colb
    in the above instnace , the retruned value is 124 12, since none of the values in colc are in (a and b)
    pls help, tx

    Please see below...
    DECLARE @TABLE TABLE
    (cola INT, colb INT, colc CHAR(10))
    INSERT INTO @TABLE VALUES(123, 12, 'a'), (123, 12, 'b'), (123, 12, 'a')
    , (124, 12, 'd'), (124, 12, 'f'), (123, 12, 'c')
    SELECT * FROM @TABLE b WHERE b.colc = 'a' OR b.colc = 'b'
    ;WITH CTE AS
    (SELECT DISTINCT cola, colb FROM @TABLE b WHERE b.colc = 'a' OR b.colc = 'b')
    SELECT DISTINCT a.cola, a.colb
    FROM @TABLE a
    LEFT JOIN CTE b ON a.cola = b.cola AND a.colb = b.colb
    WHERE b.cola IS NULL AND b.colb IS NULL
    Please mark as answer, if this has answered your question.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • Urgent pls...sql query

    Hi
    I have a sample table of empno,sal and hiredate. I have 2 duplicate rows for example
    empno sal Hiredate
    7900 1000 1-mar-03
    7900 2000 2-mar-03
    I want to eliminate the duplicate row. My query should be like this ...
    Select empno,sal,min(hiredate) .... and not any other type. Also I should not use subquery or correlated subquery within this query. It should be a single query only. In real I am using many tables. I found the duplicate rows in one table as I mentioned above for example. Thats why my query should start with those columns and it must be a single query. Can any one help me out to solve this. Please reply as early as possible. I am in most urgent.
    thanks in advance.

    Hi Andrew!
    Thanks for ur response. Eliminate in the sense, just to omit the uplicate rows while displaying and not to delete. I didnt mean to delete, I meant for display. Just to query omiting the duplicate rows. If I use sub query its getting hanged as there r 5 tables and each got more than 50,000 records in live. So I want it to be in a single query using group functions and joins and not sub query or multiple query or correlated sub query.
    The problem is if we didn't select sal column then this will work ...
    select empno,min(hiredate) from emp group by empno.
    But I must use sal column also to display, thats the problem!

  • How can i detect if my PC is not on Network..... Urgent Pls Help Soon !!!!!

    Hello Everyone,
    We all know whenever we try to connect to a PC which is not on network, we get UnKnownHostException etc..... by which we can detect that the corresponding PC is not an network(intranet/internet)
    But when i send a msg from my PC to my PC, it works fine even if the network is down. I hv provided my PC's IP address instead of using localhost or 127.0.0.1 which reduces the possibility that the msg will not be traversed thru the network.
    Any IDEA how this works.
    Is There any possible way by which i can detect that my PC is not on network or the PC to which i'm trying to connect is not on network .......
    Pls help me out, its really urgent as to be implemented in my Project
    Thanks In Advance
    Sahil Shaikh

    Hello Surtee
    I have developed a Messeging Service for the eCRM Apllication my company is developing and we r in the final stage of debugging.
    Now whenever a user sends a msg to a PC which is not on network, the messaging service automatically sends an Offline mssg to that PC. But know i want ot distinguish wheather the PC to which i'm sending the msg is not on network or am I not on network based on this i need to perform diff. actions, hence i wanted to know that how can i detect .......
    Pls see if u canhelp me out ......
    Thanks
    Sahil Shaikh

  • Hi guys (very urgent pls help me out)

    i have an doubt that iam using JBoss AS, my scienraio is
    inital when start my Application Server it will connects to mysql DB datasource, i will retrieve some values those are DB Names like oracle,sql server,db2 etc in my JSP page iam placed at combo box upto this i am very much successful but now my problem is after gettinh those values in html select box.
    if user selects Oracle and in the same screen user can enter connection config details and after submitting the request. At runtime App Server want to connect for that particular Database.
    for ex Oracle and its connection parameters then it want to connect that particular Database without restarting the server.
    so mysql is internal DB and Oracle is external db. how to manage this scienraio
    please anyone knows solution, pls help me out......
    regards
    Yadav

    hi
    the message is very clear that the sold to party ur refering is not from the same sales area. if u have the customer already then extend the same to the said sales area, by common division and distribution channel
    <b>reward points</b>
    Regards

Maybe you are looking for

  • Sync multiple devices owned by other family members to one iTunes account

    I am wondering if it is OK since we have one imac computer running iTunes in the house, but I have an iphone and ipad, my son has an iphone, my daughter has and ipod, and my wife has an iphone, if it is OK to be syncing all of our devices under MY lo

  • Recovery from backup

    Hi, How can i upload sap data from backup? OS AIX 5.3 DB Oracle 10i

  • Need ipod help please windows to mac format !

    I bought a used 2gb ipod nano. When I plug it into the computer via usb, the warning sign comes on the ipod and it says to "do not disconnect" and it just stays like that. I looked on the account menu on the ipod and it shows "windows" format. I am t

  • Configurations and flow for Service contracts

    Friends, Can anyone tell me the configuration steps to configure Service contracts with Delivery related billing. I need to configure from the scratch? Thanks!!

  • ALV Coding for SubTotal

    HI IN ALV'S HOW TO FIND THE SUB TOTAL, CODING TO FIND THE SUBTOTAL. Edited by: Alvaro Tejada Galindo on Jan 11, 2008 4:09 PM