How to use oracle rank key word

I am trying to rank my record using oracle key work row_number() but it just gives me an error message.
SELECT  g.csecnum "Section Number", e.iplineno "Line Number",ItemRank,
        e.eiitem  "Item Number", (i.idescrl ||'  '|| e.isupdes) "Item Description",
        i.iunits "Item Units", SUM (e.iqty) "Quantity",
        p.cprojnum "S.P. Number", p.contid, p.contid,
        p.prroute "Route Number",DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) "Route Number",
        INITCAP (p.clocat1 || p.clocat2 || '---' || p.cdescr) "loc",
        p.cdescr "Job Description",func_get_unit_name (iunits) "Unit Name",
        (SELECT INITCAP (func_get_county_name (ccnty1))  FROM proposal  WHERE contid = '&ContractId') "County Name"
             FROM         ( SELECT  g.csecnum "Section Number", e.iplineno "Line Number",
                             e.eiitem  "Item Number", row_number() over (order by  e.eiitem asc) as ItemRank,
                              (i.idescrl ||'  '|| e.isupdes) "Item Description",
                              i.iunits "Item Units", SUM (e.iqty) "Quantity",
                               p.cprojnum "S.P. Number", p.contid, p.contid,
                               p.prroute "Route Number",DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) "Route Number",
                               INITCAP (p.clocat1 || p.clocat2 || '---' || p.cdescr) "loc",
                               p.cdescr "Job Description",func_get_unit_name (iunits) "Unit Name",
                            (SELECT INITCAP (func_get_county_name (ccnty1))  FROM proposal  WHERE contid = '&ContractId') "County Name"
                    FROM itemlist i, estitem e, estcatg g, propproj x, proposal p
                    WHERE   p.contid = x.contid AND x.pcn = g.pcn AND e.pcn = g.pcn AND e.cn = g.cn AND i.item = e.eiitem
                                 AND i.ispecyr = p.cspecyr AND e.iplineno <> ' ' AND e.eiitem <> '2550601/01000'
                                 AND e.eiitem <> '2565601/00031' AND e.eiitem <> '2565601/00032' AND e.eiitem <> '2565601/00033'
                                 AND e.eiitem <> '2402601/01000' AND p.contid = '&ContractId'         
                               GROUP BY g.csecnum, i.iunits,p.clocat1,p.clocat2,p.contid,p.cdescr, p.cprojnum,i.iunits,p.prroute, e.iplineno,e.eiitem, i.idescrl,e.isupdes
                              ) ItemNumberRank

thanks guys for the help. yes, I do not have a where clause in the query that I posted here and I do not need until I convert this query to a procedure since the value for the where clause is passing from the .net page. I tried to clean it up a little bit by getting rid of all the alias and still not working ....
SELECT   ItemRank, g.csecnum , e.iplineno , e.eiitem , (i.idescrl ||'  '|| e.isupdes) ,
         SUM (e.iqty) ,  p.cprojnum , p.contid, p.prroute ,DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute) ,
         INITCAP (p.clocat1 || p.clocat2 || '---' || p.cdescr) , p.cdescr ,func_get_unit_name (iunits) ,
         (SELECT INITCAP (func_get_county_name (ccnty1))  FROM proposal  WHERE contid = '&ContractId')
FROM           (SELECT     row_number() over (order by  e.eiitem asc) as ItemRank,g.csecnum , e.iplineno , e.eiitem ,
                               (i.idescrl ||'  '|| e.isupdes) , SUM (e.iqty) ,  p.cprojnum , p.contid,
                                p.prroute ,DECODE (TRIM (p.prroute), NULL, 'N/A',p.prroute),
                                INITCAP (p.clocat1 || p.clocat2 || '---' || p.cdescr) ,
                                p.cdescr ,func_get_unit_name (iunits) ,
                             (SELECT INITCAP (func_get_county_name (ccnty1))  FROM proposal  WHERE contid = '&ContractId')
                    FROM itemlist i, estitem e, estcatg g, propproj x, proposal p
                    WHERE    p.contid = x.contid AND x.pcn = g.pcn AND e.pcn = g.pcn AND e.cn = g.cn AND i.item = e.eiitem
                                 AND i.ispecyr = p.cspecyr AND e.iplineno <> ' ' AND e.eiitem <> '2550601/01000'
                                 AND e.eiitem <> '2565601/00031' AND e.eiitem <> '2565601/00032' AND e.eiitem <> '2565601/00033'
                                 AND e.eiitem <> '2402601/01000' AND p.contid = '&ContractId'         
                               GROUP BY g.csecnum, i.iunits,p.clocat1,p.clocat2,p.contid,p.cdescr, p.cprojnum,i.iunits,p.prroute, e.iplineno,e.eiitem, i.idescrl,e.isupdes
                              ) ItemNumberRank

Similar Messages

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use standard function keys as custom keys

    how to use standard function keys as custom keys.
    i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
    kindly help me out.

    Hi ,
    Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
    If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
    Thanks

  • How to use oracle fusion middleware for integration project ?

    hi all,
    in my projects, customer (a bank) already has many applications (bankend & frontend) that are complicatedly connected. I intend to use oracle fusion middleware to integrate all applications and make adding new applications in the future easier. I have worked through documents in the oracle website but I still have no idea how to use oracle fusion middleware to address the requirement, besides oracle fusion middleware includes a bundle of applications I don't know which one I would need.
    could anyone give me some instructions ? appreciate your help.
    thank very much,

    Hi,
    For this short description of environment, could be ODI is a incredible tool to help you...
    Take a look into my blog that has a lot of concepts and "how to do" instructions.... http://odiexperts.com
    However to try help you, what are the used technologies?
    Where are you from?
    Cezar Santos
    http://odiexperts.com

  • Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Hi fellow apple guys, i have this problem. Hope you can help me. I don't know how to use the function keys (F1 to F12) on my macbook air. Pls help

    Out of the box, to use the function keys as function keys, hold down the fn key when you press the key. Otherwise, you get the picture function on the key. You can reverse this behavior in the Keyboard system prefs.

  • What is use of LOAD key word in ABAP-HR

    what is use of LOAD key word in ABAP-HR?

    Hi,
    LOAD keyword is used to load all the parameter values.
    Basic form
    LOAD REPORT prog PART part INTO itab.
    Variants
    1. LOAD REPORT prog PART 'HEAD' INTO itab.
    2. LOAD REPORT prog PART 'TRIG' INTO itab.
    3. LOAD REPORT prog PART 'CONT' INTO itab.
    4. LOAD REPORT prog PART 'DATA' INTO itab.
    5. LOAD REPORT prog PART 'DDNM' INTO itab.
    6. LOAD REPORT prog PART 'DATV' INTO itab.
    7. LOAD REPORT prog PART 'SELC' INTO itab.
    8. LOAD REPORT prog PART 'STOR' INTO itab.
    9. LOAD REPORT prog PART 'LITL' INTO itab.
    10. LOAD REPORT prog PART 'SYMB' INTO itab.
    11. LOAD REPORT prog PART 'LREF' INTO itab.
    12. LOAD REPORT prog PART 'SSCR' INTO itab.
    13. LOAD REPORT prog PART 'BASE' INTO itab.
    14. LOAD REPORT prog PART 'INIT' INTO itab.
    15. LOAD REPORT prog PART 'DATP' INTO itab.
    16. LOAD REPORT prog PART 'TXID' INTO itab.
    17. LOAD REPORT prog PART 'COMP' INTO itab.
    Effect
    Loads the specified part of the generated version of the program prog into the internal table itab (for analysis purposes only).
    The return code value is set as follows:
    SY-SUBRC = 0 The load for the program prog exists and is current.
    SY_SUBRC = 4 The load for the program prog does not exist.
    SY-SUBRC = 8 The load for the program prog exists, but is not current. In some cases, this SY-SUBRC may mean that the program load has been destroyed. You can resolve this by generating the program. With PART 'LREF' , SY-SUBRC = 8 means that the line reference table is incorrect for the program. With PART 'CONT' , it means that the reference part of the internal table is empty.
    itab has been filled only if SY-SUBRC = 0 .
    Reward points if useful.
    Regards,
    Sekhar

  • How to Use Home+End Key on new short usb apple keyboard on XP

    How to Use Home+End Key on new short usb apple keyboard on XP
    now i use macbook and new short apple keyboard.
    it hasn't Home and End key. i try to use Fn + -> , Fn + <-
    it cann't do that. How can i set the Fn + <- be Home key
    and Fn + -> be End key like on my macbook keyboard
    thank you for answer

    Easy, no need to be harsh. I might not be a Level 9  Discussions user, but I’ve been an Apple Technician for more than a decade now. So believe me, I know what I’m talking about. Be it OS X Server or emptying the Trash. But even I come here from time to time to learn from others. Well, back to topic and being a little more specific:
    The 'My Info' setting always belongs to the first iCloud account you add to an iOS device. In this account you create at least 1 contact, the one you will be using for 'My Info'. You then do the same on your other iOS device using NOT the same iCloud account, of course. You only need to enable contacts syncing in iCloud preferences for these primary accounts. From here on you can use differing 'My Info' on your 2 iOS devices without a problem.
    But you may know that you can use more than one iCloud account at a time. Only the primary one will offer all iCloud options like Photostream. But what they all offer is contacts, calendars, etc. So if you intend (and I did) to share these 2 between your devices you can add them using a second iCloud account to both of your iOS devices. This makes it 3 accounts all in all. You could even go further and add another one just for 'Find my iPhone' if you like.
    I would’ve used the built-in sharing of Calendar.app instead, but Contacts.app does not (yet) offer sharing contacts with others. That’s why I went with the third iCloud account as a secondary account to both iOS devices.
    Apple of course recommends using just one Apple ID for everything to make it easier. But in some scenarios this just won’t cut it, which is even described in one of their support documents.
    I hope that now you have an idea what I’ve done…
    Good night
    Björn
    PS: It would be nice if people did not insist on being right. They too can sometimes learn something!

  • How to use Oracle refcursor dataset output parameter from SP

    Can I request for help on how to use Oracle Output parameter from a stored procedure as a source. I need the output tobe stored in a flat file
    Thanks
    Abhijit
    Message was edited by:
    Abhijit77

    yes I would like to use it for ODI.. I would like the ouput of the refcursor to be fed to a text file using ODI. How to handle the records returned by the refcursor and map with txt file.

  • What is the use of Volatile Key word ??

    what is the use of Volatile Key word ??
    There is a primitive variable
    volatile int b = 10; // this is a master copy
    Locally thread A changes this int b as 5.
    Locally thread B changes this int b as 20.
    thread c want to use this int b.
    now what c will get??
    If didn't use volatile what will happen.
    Regards
    Dhinesh

    Deenu wrote:
    what is the use of Volatile Key word ??Why don't you ever reply to any of your threads? You never thank anyone for helping you, and this makes you one of the worst trolls out there.

  • Use of "super" key word in abap oops...

    Hi,
      Can any one explain me what is the use of ' super ' key word in abap oops. excluding super class.
    With Regards,
    M.S.Amirtharaj Vijay.

    Vijay,
    please read the sap documentation or f1 help
    Thanks
    Bala Duvvuri

  • How to Use Oracle 8i with MapX?

    I am trying to work with oracle 8i 1.6 and mapX 4.5 but un-able to do so. I tried by adding server layer but couldn't do so.
    Help !!

    Crossposted: Re: How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use Oracle DB Sequence to Generate Primary Key Values?

    Dear Members,
    I am using Oracle JDev V 11.1.2.1.0 and Oracle 11g XE Database.
    I have followed the below steps:-
    1/ Created an EmployeesEO
    2/ Created an EmployeesVO
    3/ Created a JSPX Page
    4/ On the JSPX Page I have dragged the EmployeesVO and created it in ADF Table Format.
    On this page when I create a new record, I want to generate employee id automatically based on a sequence which is created in the database of the HR Schema.
    Please let me know how to achieve the above requirement.
    Many thanks in advance.
    Regards.

    check [url http://mjabr.wordpress.com/2011/03/11/make-sequence-number-as-default-value/]Set an attribute’s default value with a sequence number

  • How to use Oracle text

    I'm storing files in a blob field in a 9i database, sometimes I need to query using the details stored in the database about the file and sometimes I need to search the files to find matches with some text (like search engine), I was told that oracle text can help me accomplish this functionality , however I don't know if it supports arabic text and I don't know how to use it from my application developed in 9i.
    Regards.

    Friend by using these step you can easily use Oracle inter text media
    j a h a n z e b
    [email protected]
    Oracle Developer
    6th Floor, State Bank of Pakistan
    I.I.Chundrigar Road, Karachi.
    Please note that in SqlPlus you can use '?' in stead of $ORACLE_HOME, and this works on Unix and Windows so if you want to execute $ORACLE_HOME/rdbms/admin/catalog.sql you can simply use:
    on Unix sql> @?/rdbms/admin/catalog.sql
    on Windows sql> @?\rdbms\admin\catalog.sql
    5.2.1 Explanation of installation steps
    1. Connected to database as SYSDBA and create CTXSYS user:
    Ctxsys user is created by calling following script:
    @?/ctx/admin/dr0csys.sql <ctxsys> <system> <temp>
    Where:
    change_on_install - is the ctxsys user password
    DRSYS - is the default tablespace for ctxsys
    TEMP - is the temporary tablespace for ctxsys
    This will create user CTXSYS and grants full privileges to CTXSYS in order to create and insert into result tables, execute callbacks, rewrite queries, and perform system cleanup. At this point CTXSYS will not own any objects.ss
    2. Connected to database as CTXSYS and create all necessary objects
    All necessary object are creates by calling following script:
    connect CTXSYS/change_on_install
    @?/ctx/admin/dr0inst <replace with $ORACLE_HOME>/ctx/lib/libctxx9.so;
    Please not that you have to put full path to your ORACLE_HOME, for example home as paramter
    On Solaris/Aix/Linux with $ORACLE_HOME of /u01/app/oracle/product/8.1.7
    @?/ctx/admin/dr0inst.sql /u01/app/oracle/product/8.1.7/ctx/lib/libctxx8.so
    On HP-UX with $ORACLE_HOME of /u01/app/oracle/product/8.1.7
    @?/ctx/admin/dr0inst.sql /u01/app/oracle/product/8.1.7/ctx/lib/libctxx8.sl
    Windows NT/2000 with D:\oracle\product\8.1.7
    @?/ctx/admin/dr0inst.sql D:\oracle\product\8.1.7\bin\oractxx8.dll
    This will installs all Oracle database objects required by the Oracle Text system. This includes:
    a) Data dictionary tables, views, sequence, packages
    b) Server management tables, views and packages
    c) Dispatcher packages
    d) Service queue objects
    3) Install appropriate language-specific default preferences.
    The next step is to install appropriate language-specific default preferences.When you use CREATE INDEX to create an index or ALTER INDEX to manage an index, you can optionally specify indexing preferences in the parameter string. There are seven preference classes:
    - Lexer, defines the language being indexed. ( language specific )
    - Wordlist, defines the expantion of stem and fuzzy queries. ( language specific )
    - Stoplist, defines words and themes that are not be indexed. ( language specific )
    - Datastore, defines document storage.
    - Filter, defines standards for converion of documents to plaintext.
    - Storage, defines the storage of the index tables.
    - Section group, enables possibilities to define document sections.
    There is script which creates language-specific default preferences for every language Oracle text supports in <ORACLE_HOME>/ctx/admin/defaults directory, such as English(US), Danish(DK), Dutch(NL), Finnish(SF), French(FR), German(DE), Italian(IT), Portuguese(PR), Spanish(ES), and Swedish(S). They are named in the form drdefXX.sql, where XX is the language code. To manually install US default preferences, for example, log into sqlplus as CTXSYS, and run 'drdefus.sql' as described below:
    @?/ctx/admin/defaults/drdefus.sql
    create user textuser identified by textuser
    default tablespace users
    temporary tablespace temp;
    -- You must grant 'ctxapp' role to textuser
    grant connect, resource, ctxapp to textuser;
    connect textuser/textuser
    drop table quick;
    create table quick (
    quick_id number
    constraint quick_pk primary key,
    text varchar2(80) );
    insert into quick ( quick_id, text ) values (1,'The cat sat on the mat');
    insert into quick ( quick_id, text ) values (2,'The quick brown fox jumps over the lazy dog' );
    insert into quick ( quick_id, text ) values (3,'The dog barked like a dog');
    commit;
    create index quick_text on quick ( text )
    indextype is ctxsys.context;
    col text format a45
    col s format 999
    select text, score(42) s from quick
    where contains ( text, 'dog', 42 ) > 0
    order by s desc;

  • How to use synonyms on multiple word search ?

    We use context with multiword search like this one :
    select * from my_table where contains(my_text,'the small building near the river')>0
    Now we have specific synonyms in a thesaurus. How do we write the contains clause ?
    contains(my_text,'syn(the,thes) and syn(small,thes) and syn(building,thes) and syn(near,thes) and syn (river,thes)')>0 does not fin the synonym for "small building"="house" for instance
    contains(my_text,'syn(the small building near the river,thes)')>0 does only for synonyms on the full sentence.
    More generally is there an Oracle Document which describes how to use SYN, FUZZY and combine them, since
    the reference documentation gives only limited information on this ?
    Have a nice day

    The thesaurus functionality is not currently built for stuff like this.
    if you want to combine fuzzy and thesaurus, I am assuming you want to do fuzzy first, to correct any misspelling,
    then thesaurus on the "corrected" spellings? You'd have to do something like:
    1. take the query and run ctx_query.explain to break it down and do the fuzzy expansion
    2. work through the fuzzy expansion and build a new query string by sticking SYN() around each
    expanded word
    As for thesaurus expansion and phrase, these are not compatible. Thesaurus expansions use "," and "|", and so
    you cannot have a phrase of thesaurus expansions.
    I see what you're getting at, but you would need sub phrase detection, phrase equivalence, etc., which is
    currently beyond the thesaurus function capability.
    You can use themes (ABOUT) on phrases, and it will do something like what you are describing. You might want
    to check that out.

  • How to use oracle thin driver?...pls help

    Hello. I am trying to insert a word file into my Oracle 9i database using JSP. I have tomcat running as my standalone server. So far, i have been using the sun.jdbc.odbc driver to implement all my DB accesses. Recently however, i found out that in order to use Oracle specific objects such as BLOBS or BFILES, i have to use the oracle thin driver or OCI driver.
    So far, i have downloaded the thin driver and put it into the tomcat shared/common folder and also put the .jar file into my classpath. Now, i am having trouble as to how to call the oracle thin driver inside my JSP code.
    My previous code read as:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:Andy","user","pass");
    How do i switch over to the oracle thin driver in JSP? Any help would be much appreciated. Thank you
    Andrew

    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@hostname:port:SSID", "user", "password");

Maybe you are looking for