Max sal using set or join operations

Hi,
how to write a sql query to retrieve max sal of an emp table without using max()function.
and using only set operations or join conditions..
cheers..

You can use an analytic function for this. You can either use ROW_NUMBER or RANK or DENSE_RANK
with my_emp
as
select empno, ename, sal, rank() over(order by sal desc) rk
  from emp
select empno, ename, sal
  from my_emp
where rk = 1

Similar Messages

  • Getting Compilation error when used SET or MULTISET operator on nested tabl

    Dear All,
    I am getting Compilation error when used SET or MULTISET operator on nested tables inside a procedure.
    This is working fine in other DB installations of 10g but does not work in another 10g DB.
    it says "wrong number of parameter or datatype used in SET"
    Can any one suggest what went wrong here?
    Thanks in advance.

    Can any one suggest what went wrong here?Only if you would post the query and Oracle versions on both databases.
    Besides, this forum deals with issues in Oracle product installation. So post this query in SQL PL/SQL forum for better response.

  • Compilation error when used SET or MULTISET operator on nested tables

    Dear All,
    I am getting Compilation error when used SET or MULTISET operator on nested tables inside a procedure.
    This is working fine in other DB installations of 10g but does not work in another 10g DB.
    it says "wrong number of parameter or datatype used in SET"
    Can any one suggest what went wrong here?
    Thanks in advance.

    Hi,
    Thanks for ur reply...
    Since MULTISET and SET operators are the new additions in base 10g release for manipulation of nested tables data, I am surprised that same is working in similar 5 DBs installations with 10.2.0.1.0 version, but does not work in the sixth.
    SET and MULTISET operators are used inside the PL/SQL procedure which is getting compiled in the above mentioned 5 DBs but not in sixth DB.
    it gives
    On line: 3112
    PLS-00306: wrong number or types of arguments in call to 'SET'
    Hope this clarifies the issue...

  • Default sales org on selection screen using set and get parameter!!

    Hi,
    I need to default value on selection screen using SET n GET parameter...logic to be used should be:
    Sales Organisation:
    This field should be filled by default using the user parameter id VKO. (using sentence GET PARAMETER and SET PARAMETER)...
    Hope i need to write the code in initialisation and what shud b the content?
    Regards
    Gunjan

    hi,
    TABLES <table name>.
      SET PARAMETER ID VKO FIELD <tablename-fieldname>.
    call transaction 'zxx'.
    try this sample program,
    REPORT BOOKINGS NO STANDARD PAGE HEADING.
    TABLES SBOOK.
    START-OF-SELECTION.
      WRITE: 'Select a booking',
      SKIP.
    GET SBOOK.
      WRITE: SBOOK-CARRID, SBOOK-CONNID,
             SBOOK-FLDATE, SBOOK-BOOKID.
      HIDE:  SBOOK-CARRID, SBOOK-CONNID,
             SBOOK-FLDATE, SBOOK-BOOKID.
    AT LINE-SELECTION.
      SET PARAMETER ID: 'CAR' FIELD SBOOK-CARRID,
                        'CON' FIELD SBOOK-CONNID,
                        'DAY' FIELD SBOOK-FLDATE,
                        'BOK' FIELD SBOOK-BOOKID.
      CALL TRANSACTION 'BOOK'.
    regards,
    siva
    Message was edited by:
            Shan

  • I got a new iPhone yesterday. The sales people set it up to use. I want to have all the apps, pics, etc from my iPod to be on the new iPhone. How do I do this from my iCloud backup  of the iPod??

    I got a new iPhone yesterday. The sales people set it up to use. I want to have all the apps, pics, etc from my iPod to be on the new iPhone. How do I do this from my iCloud backup  of the iPod??

    http://support.apple.com/kb/HT1766?viewlocale=en_US&locale=en_US
    Go to Settings>General>Reset and tap Erase All Content and Settings.  This will erase your device.  Then you will go through the setup screens again as you did when your device was new, and when given the option, select Restore from iCloud Backup.
    This link gives another overview of backup and restore:
    http://support.apple.com/kb/HT4859?viewlocale=en_US&locale=en_US
    Be aware that photos should always be synced to a computer for archiving and that relying on a restore from an icloud backup may not return all (or any) of your photos.  Once on the computer, you can sync the photos to the new device...
    Syncing Photos:
    From device to computer...
    http://support.apple.com/kb/HT4083
    From computer to device...
    http://support.apple.com/kb/HT4236

  • Can we perform Join operation using SQLCall with Datatabae Query

    Hi,
    I am working on Toplink SQLCall query. I am performing join operation but, it is giving error.
    so please, any can tell me . we can perform join operation using SQLCall with Database Query
    Thanking You.

    You can use joining with SQLCall queries in TopLink, provided your SQL returns all of the required fields.
    What is the query you are executing and what error are you getting?

  • Doubt Regarding LEFT JOIN Operation

    Hello,
    With the Old syntax in place it is easier for find that which join is performed on which table ...
    But with the new syntax ..m getting bit confused when INNER & LEFT JOINS used together ...
    Below is the FROM clause ...please explain .. how this JOIN is gonna take place ..& which table is Left joined with whom...
    FROM VW_TRANS_MANAGER_SALES ref_1
    LEFT OUTER JOIN VW_AGREE_ASSIGN_TAG_DTLS ass
    ON Trim(ass.agreement_id) = trim(ref_1.AGREEMENT_ID)
    LEFT OUTER JOIN VW_CURENT_RATING_DTLS CURR
    ON (ref_1.company_code =curr.COMPANYCODE)
    LEFT OUTER JOIN VW_PREV_RATING_DETAILS PREV
    ON (ref_1.company_code =prev.COMPANYCODE)
    LEFT OUTER JOIN CRMADMIN.CO_MA_COMPANY_CONTACTS cont
    ON (ref_1.CLIENT_CONTACT_ID= cont.CONTACT_ID)
    LEFT OUTER JOIN CRMADMIN.COR_CRM_MST_CITY city
    ON (city.City_id= cont.City_id))
    ---------------------------------------------------------------------------------------------------------------------------------------

    Hi,
    Aijaz Mallick wrote:
    Yeah .. but was a bit Confusing as u used 2 columns in each table....
    Doesn't it depends on the joining condition we use ... lets Say ..if i use an INNER join after 2 LEFT join ... & m doing an that inner join with the first SOURCE table .... then will it perform a join on the resultset on the previous Joins...???Sorry, I'm not sure what you're asking.
    Please post a specific example of a join that you don't understand, or some results that you don't know how to get.
    Use commonly available tables (like those in the scott or hr schemas) or post your own CREATE TABLE and INSERT statements.
    Using ANSI syntax, the results are as if the joins were done in the order they appear in the FROM clause (even though the optimizer may not actually do them in that order).
    For example, in the querry below, the inner-join between emp and salgrade is done first, then the outer join with dept is done to that result set.
    SELECT     d.dname
    ,     e.ename
    ,     g.losal
    FROM          scott.emp     e
    JOIN          scott.salgrade     g     ON     e.sal     BETWEEN     g.losal
                                       AND     g.hisal
    RIGHT OUTER JOIN  scott.dept     d     ON     e.deptno     = d.deptno
    ;Output:
    DNAME          ENAME           LOSAL
    ACCOUNTING     CLARK            2001
    ACCOUNTING     MILLER           1201
    ACCOUNTING     KING             3001
    RESEARCH       FORD             2001
    RESEARCH       SCOTT            2001
    RESEARCH       JONES            2001
    RESEARCH       ADAMS             700
    RESEARCH       SMITH             700
    SALES          BLAKE            2001
    SALES          ALLEN            1401
    SALES          MARTIN           1201
    SALES          WARD             1201
    SALES          JAMES             700
    SALES          TURNER           1401
    OPERATIONSNotice that the OPERATIONS department, which has no matches in the other tables, is still included because of the outer join.
    If you want to have the joins done in a different order, you can explicitly join some table first, either in a sub-query or just by grouping joins within parentheses in the same FROM clause, as in the query below (which produces the same results as the query above):
    SELECT     d.dname
    ,     e.ename
    ,     g.losal
    FROM          scott.dept     d
    LEFT OUTER JOIN     (     -- Join the following tables first:
                   scott.emp     e
              JOIN     scott.salgrade     g     ON     e.sal     BETWEEN     g.losal
                                            AND     g.hisal
              )     ON     d.deptno     = e.deptno
    ;

  • Non-ANSI Outer Join Operator Issue (reposted due to text issues)

    I am currently using Designer 11.5.0.0. Itu2019s XI Rel 2, but Iu2019m not sure what service pack. I have created several universes with outer joins against a SQL Server 2005 database, but when I try using them in a Crystal report, I get the following error:
    Failed to retrieve date from the database. Details: 42000:[Microsoft][ODBC SQL Server Driver][SQL Server] The query uses non-ANSI outer join operators (u201C=u201D or u201C=u201D). To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.
    Here is my ODBC DSN configuration:
    Microsoft SQL Server ODBC Driver Version 03.85.1132
    Data Source Name: FlexOPS
    Data Source Description:
    Server: dalsvrw031
    Database: (Default)
    Language: (Default)
    Translate Character
    Data: Yes
    Log Long Running Queries: No
    Log Driver Statistics: No
    Use Integrated Security: No
    Use Regional Settings: No
    Prepared Statements Option: Drop temporary procedures on disconnect
    Use Failover Server: No
    Use ANSI Quoted Identifiers: Yes
    Use ANSI Null, Paddings and Warnings: Yes
    Data Encryption: No
    Okay, so I understand what the issue is. It appears that the version of Designer that I am using does not default the ANSI92 parameter to u201CYesu201D. So all the outer joins I have created in each of my universe are using the old *= as the join operator. And apparently, the ODBC driver I am using is not very happy with that.
    As I understand it from what Iu2019ve read on other sites, I have the following options:
    1) Set the ANSI92 parameter to Yes, drop all my joins, close and re-open Designer, and recreate all of the joins.
    2) Find a different driver or connectivity method that will support non-ANSI joins.
    3) Set my database back to SQL 2000 compatibility.
    Option 1 is unappealing as it will cause a lot of time redoing all the work that Iu2019ve spent the past month doing. Option 2 is only a band-aid fix at best. Option 3 really isnu2019t an option for us.

    So I am wondering what other options I have to change these non-ANSI joins to ANSI compatible joins. Do I need to update Designer with a service pack? Is there a script out there that will automatically do this in each of the universes? I would appreciate any suggestions or guidance on this.
    Thanks,
    Lee

  • Non-ANSI Outer Join Operator Issue

    I am currently using Designer 11.5.0.0.  Itu2019s XI Rel 2, but Iu2019m not sure what service pack.  I have created several universes with outer joins against a SQL Server 2005 database, but when I try using them in a Crystal report, I get the following error:
    Failed to retrieve date from the database.
    Details:  42000:[Microsoft][ODBC SQL Server Driver][SQL Server] The query uses non-ANSI outer join operators (u201C=u201D or u201C=u201D).  To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel.  It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN).  In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.
    Here is my ODBC DSN configuration:
    Microsoft SQL Server ODBC Driver Version 03.85.1132
    Data Source Name: FlexOPS
    Data Source Description:
    Server: dalsvrw031
    Database: (Default)
    Language: (Default)
    Translate Character Data: Yes
    Log Long Running Queries: No
    Log Driver Statistics: No
    Use Integrated Security: No
    Use Regional Settings: No
    Prepared Statements Option: Drop temporary procedures on disconnect
    Use Failover Server: No
    Use ANSI Quoted Identifiers: Yes
    Use ANSI Null, Paddings and Warnings: Yes
    Data Encryption: No
    Okay, so I understand what the issue is.  It appears that the version of Designer that I am using does not default the ANSI92 parameter to u201CYesu201D.  So all the outer joins I have created in each of my universe are using the old *= as the join operator.  And apparently, the ODBC driver I am using is not very happy with that.
    As I understand it from what Iu2019ve read on other sites, I have the following options:
    1)   Set the ANSI92 parameter to Yes, drop all my joins, close and re-open Designer, and recreate all of the joins.
    2)   Find a different driver or connectivity method that will support non-ANSI joins.
    3)   Set my database back to SQL 2000 compatibility.
    Option 1 is unappealing as it will cause a lot of time redoing all the work that Iu2019ve spent the past month doing.  Option 2 is only a band-aid fix at best.  Option 3 really isnu2019t an option for us.
    So I am wondering what other options I have to change these non-ANSI joins to ANSI compatible joins.  Do I need to update Designer with a service pack?  Is there a script out there that will automatically do this in each of the universes?
    I would appreciate any suggestions or guidance on this.
    Thanks,
    Lee
    Edited by: Lee Vance on Jul 6, 2009 10:02 PM

    Hi,
    try the following:
    open your universe in the Universe designer, go to File->Parameter, select the Parameter tab and change the value of the ANSI92 parameter from No to Yes.
    Regards,
    Stratos

  • /etc/profile: line 28: ulimit: max locked memory: cannot modify limit: Oper

    Hi;
    I writed one sh which is checking tablespace size and its working well ( i used this before for someother client) Now i try to run it on one server and i have this error:
    /etc/profile: line 28: ulimit: max locked memory: cannot modify limit: Operation not permitted in /var/spool/mail/root
    Anyone has idea what is problem?
    Thanks

    Well, check line 28 of /etc/profile, and see what command it is trying to execute. If it's a ulimit -l command, check if the value it is trying to set the limit to is higher than the current ulimit value of the current user. If it is, then that operation is not allowed. You can increase the limit for the current user (at login time) by modifying /etc/security/limits.conf . This is documented in the various guides, notes, whitepapers that talk about installing Oracle database on Linux.

  • Does Toplink support PL/SQL storedProcedure (cursor + join operation)

    Hi,
    Context:- There are two table with relation (Emp, Dept). I am getting data from both table by using Join opeation.
    I am working on Toplink storedProcedureCall and want to get PL/SQL Cursor + join operation
    for example:- select d.dname,e.ename,e.sal from emp e, dept d where e.deptno=d.deptno;
    it's working fine but, when I am dragging DataControl on Form it's only showing EMP attribute but, I need to both EMP,DEPT attribute so that I can display ADF readonly Table control.
    please, help me out. Thanking You.
    regards,
    sufi

    Hello Adilz,
    You seem to have posted a number of times trying to get cursors to work. Cursors do work, and in this case it looks like your stored proc is not working because the procedure you are calling does not accept any output variables - hence the error stating the wrong number of arguments.
    Try defining read_emp and ename in your stored procedure definition in the database.
    Best Regards,
    Chris

  • How to use pre-mapping process operator

    Hi,
    I am using OWB version 10.1.0.4.0.
    There are two source tables namely src1_tb(id1,field1,field2), src2_tb(id2,field3,field4) and a target table namely target_tb(id1,id2,field1,field2,field3,field4).
    It's a simple mapping with a join operator. Here, when I try to use a pre-mapping process operator 'LENGTH', with input from outgroup of join operator (field1) and output linked to an added field( VALUE_LENGTH) in Traget Table, it gives error "VLD-2451: Connection to premapping is invalid" and a warning "VLD-1008 :Referenced mapping column VALUE_LENGTH" does not exist"
    Can anyone please let me know how to use pre-mapping process operator.
    Any help will be greatly appreciated.
    Regards,
    Pawan

    yes, a pre-mapping procedure is not what you want here.
    Pre-mapping procedures run once when the mapping initializes and before the actual ETL is run. IT is a place where you could do some custom data cleansing / validation, populate your own audit loggin tables if you wish, or whatever other things you might like to do.
    For what you are describing, you want to pass the field through an expression object. Drop the Expression on the canvas and drag a link from the field in your OUTGRP to the INGRP on the expression This will auto-create the corresponding ingrp attribute in the expression for that field. Then double-click the expression object to bring up it's properties sheet. You will then want to create an OUTGRP attribute called length_value of type number, and set it's Expression property to length(ingrp1.your_Field_name_here). You can then connect from this outgrp field to your field in the target table.
    Cheers,
    Mike

  • I am using your software: CS^ InDesign Suite on a PC using a Windows 7 operating system.     Due to eyesight issues, I need to have the menu bars of programs in easy-to-read font and picture size.  Specifically, the menu bar

    Hi,
    I am using your software: CS6 InDesign Suiteon a PC using a Windows 7 operating system.
    Due to eyesight issues, I need to have the menu bars of programs in easy-to-read font and picture size.  Specifically, the menu bar across the top (File, Edit, View, etc.), and the menu bar on the left side with the graphic depiction of options.
    In earlier versions of Windows (e.g. XP), whenever I changed the screen resolution on my computer to a lesser resolution in order to show the link icons on my desktop in a larger, more readable size, all the software programs, including yours, appeared on my screen with the menu bars in the larger font size that I needed.
    However, in Windows 7, this is not the case.  Even though I have selected the lowest resolution, making the icons on my desktop extremely large, I cannot read the options across the top menu bar of your program, nor the pull-down menu items that they contain.  I cannot see the graphic depictions of options on the left side of the screen. They are all too small.  How can I make your program increase the size?

    CS6 is not high-DPI compatible/ enabled and that can't be changed. If you cannot6 make it work with your operating system means, then short of joining Creative Cloud and using newer versions there is nothing you can do.
    Mylenium

  • Using Case and Joins in update statement

    Hi all,
    I need to update one column in my table...but need to use case and joins...I wrote the query and it is not working
    I am getting an error msg saying...the SQL command not ended properly...
    I am not that good at SQL...Please help...
    update t1 a
    set a.name2=
    (case
    when b.msg2 in ('bingo') then '1'
    when b.msg2 in ('andrew') then '2'
    when b.msg2 in ('sam') then '3'
    else '4'
    end )
    from t1 a left outer join t2 b
    on a.name1 = b.msg1 ;
    Waiting for help on this...!
    Thanks in Advance... :)

    Another approach is to update an inline view defining the join:
    update
    ( select a.name2, b.msg2
      from   t1 a
      join   t2 b on b.msg1 = a.name1 ) q
    set q.name2 =
        case
          when q.msg2 = 'bingo' then '1'
          when q.msg2 = 'andrew' then '2'
          when q.msg2 = 'sam' then '3'
          else '4'
        end;which could also be rewritten as
    update
    ( select a.name2
           , case q.msg2
                when 'bingo'  then '1'
                when 'andrew' then '2'
                when 'sam'    then '3'
                else '4'
             end as new_name
      from   t1 a
      join   t2 b on b.msg1 = a.name1 ) q
    set name2 = new_name;The restriction is that the lookup (in this case, t2.msg1) has to be declared unique, via either a primary or unique key or unique index.
    (You don't strictly need to give the view an alias, but I used 'q' in case you tried 'a' or 'b' and wondered why they weren't recognised outside the view.)

  • Warning : PerformRecord.java use uncheck or unsafe operations

    /*When compile (with version 1.5.0_05) have a warnning message
    Note : PerformRecord.java use uncheck or unsafe operations
    Note : Recompile wiht -XLint : uncheck for details
    How can I solve this problem*/
    this is my code :
    import java.sql.*;
    import java.util.*;
    public class PerformRecord
         public static final String DEFAULT_DRIVER = "sun.jdbc.odbc.JdbcOdbcDriver";
    public static final String DEFAULT_URL = "Jdbc:Odbc:PersonalODBC";
    public static final String DEFAULT_USERNAME = "Personal";
    public static final String DEFAULT_PASSWORD = "moshan74";
         public Connection conn = null;
         public String querySQL;
         /*==Constructor class== */
         public PerformRecord()
              /*load JDBC driver*/
              try{
                   Class.forName(DEFAULT_DRIVER);
              }catch (ClassNotFoundException e){System.err.println(e.getMessage());}          
         /*===Method class*/
         /*set value for connection var*/
         public void getConnection()
              this.conn = setConnect();
         /*get QuerySQL*/
         public void setQuery(String sql)
              this.querySQL = sql;
         /*open connection */
         public Connection setConnect()
              try{
              conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);               
              }catch (SQLException e){System.err.print(e.getMessage());     }
              return conn;
         /*close connection*/
         public void closeConnect()
    try{
    conn.close();
    }catch (Exception e){ }
         /*execute query statement */
         public Object executeQuery()
              Object returnValue = null;
              try{
                   /*executing query and check result */
                   Statement stmt          = conn.createStatement();               
                   boolean hasResultSet = stmt.execute(querySQL);
                   if (hasResultSet)
                        /*get set of the record*/
                        ResultSet rs               = stmt.getResultSet();
                        /*get set of the column*/
                        ResultSetMetaData meta = rs.getMetaData();
                        /*amount column*/
                        int numColumns = meta.getColumnCount();
                        /*arrayLisst to add data*/     
                        List rows          = new ArrayList();
    while (rs.next())
    Map thisRow = new LinkedHashMap();// 1 element(1 row,i column)
    for (int i = 1; i <= numColumns; ++i)
    String columnName = meta.getColumnName(i);
    Object value = rs.getObject(columnName);
    thisRow.put(columnName, value);
    rows.add(thisRow);
    rs.close();
    stmt.close();
                   this.closeConnect();
    returnValue = rows;
    else
    int updateCount = stmt.getUpdateCount();
    returnValue = new Integer(updateCount);
              }catch (SQLException e){System.err.print(e.getMessage());     }
    return returnValue;
    ps>> I want to to use Generics to help it but I don't know how to do it in the right way . Can you you help me?
    Thanks
    Arunya

    regarding your Map/LinkedHashMap, since you keys are String and you values are Objects... you would define you Map using those two as you data type pair...
    ap<String,Object>thisRow = new LinkedHashMap<String,Object>();and similar for you List/ArrayList where you putting Maps into...
    List<Map<String,Object>> rows = new ArrayList<Map<String,Object>>();for more information on generics read...
    [url http://java.sun.com/docs/books/tutorial/java/javaOO/generics.html]Sun's The Java Tutorial : Generics
    - MaxxDmg...
    - ' He who never sleeps... '

Maybe you are looking for