Oracle 9i sql query??????????????

hello grp,thanks for you help.................
i have again some doubts to solve can anyone plz solve these..........
1) Create a query that will display the total number of employees and, of that total, the number of employees hired in 1995, 1996, 1997 and 1998.Create appropriate column headings as "Total", "1995", "1996" etc...
2) Create a matrix query to display the job, the salary for that job based on department number, and the total salary for that job, for department 20, 50, 80 and 90, giving each column an appropriate heading.
till now i have learnt use of multiple row functions and not subqueries,n solutions to above queries r not given.so plz help me out guys
thanx again in advance............

Ok, as you're obviously still struggling, I'll give you a pointer for the first question without actually doing it with your data...
SQL> create table mydata (val number);
Table created.
SQL> insert into mydata values (1);
1 row created.
SQL> insert into mydata values (2);
1 row created.
SQL> insert into mydata values (3);
1 row created.
SQL> insert into mydata values (1);
1 row created.
SQL> insert into mydata values (2);
1 row created.
SQL> insert into mydata values (4);
1 row created.
SQL> ed
Wrote file afiedt.buf
  1  select cnt.total,
  2         sum(decode(mydata.val,1,1)) as val1,
  3         sum(decode(mydata.val,2,1)) as val2,
  4         sum(decode(mydata.val,3,1)) as val3,
  5         sum(decode(mydata.val,4,1)) as val4
  6  from mydata,
  7       (select count(*) as total from mydata) cnt
  8* group by cnt.total
SQL> /
     TOTAL       VAL1       VAL2       VAL3       VAL4
         6          2          2          1          1
SQL>Now see if you can adapt that for your own data and let us know how you get on.
Then have an attempt yourself at the second question and come back to us with whatever you have done and we can help to correct it for you.
You'll only learn if you understand what it's doing yourself.

Similar Messages

  • Oracle XSU: oracle.xml.sql.query.OracleXMLQuery is not recognized

    Hi, there!
    I've got a problem when tryed to use Oracle XSU (xml-sql utility to generate xml). My simple java application works fine using XSU. But when I created session stateless bean I've got an EJBException regarding this
    line:
    oracle.xml.sql.query.OracleXMLQuery qry = new oracle.xml.sql.query.OracleXMLQuery(conn, commandSQLStatement);
    It doesn't recognize OracleXMLQuery class as I've got in dump. So my classpath includes original location of that utility and Oracle parser.
    I really appreciate for any help.
    Thanks.
    strXML = qry.getXMLString();

    Patricia,
    Did you go through the link
    Re: XML SQL Utility
    You have to put xsu12.jar in the lib directory of the jdev.
    xsu12.jar is in the lib directory of the XDK installation.
    You can download XDK from
    http://www.oracle.com/technology/tech/xml/xdk/software/prod/xdk_java.html
    Just download the XDK kit, get the xsu12.jar from the lib directory and put in the lib directory of the jdev.
    -- Arvind

  • Oracle.xml.sql.query.OracleXMLQuery   GetXML -withDTD

    I'm trying to create a dtd for each table in my schema. I've created a java program that loops through the user_tables and I am then trying to create the DTD with oracle.xml.sql.query.OracleXMLQuery -withDTD. I am able to make it work using the XSU Command Line Utility, but I'm having a hard time trying to find out where the -withDTD flag goes inside my java program. Anyone know how to use the -withDTD option inside of a java program?
    Thanks

    [from XmlRpc-Java]
    As a result, my XML
    is contained in a String instead of an InputStream.
    It is possible to convert a String to an InputStream using
    StringBufferInputStream, but this class is deprecated in favor of
    StringReader (as StringBufferInputStream does not properly convert
    characters into bytes).
    For the default HTTP transport, an InputStreamReader could be used to
    wrap the InputStream before calling parse().
    Ultimately, the InputStream is converted to an InputSource for use by
    the SAX parser. InputSource will accept a Reader as well.
    [from XmlRpc-Java]
    There should be a way to go from "getXMLString()" to "parse(Reader)" also. In the meantime I'm stuck.
    null

  • Oracle.xml.sql.query.OracleXMLQuery not found

    Hi!
    Sorry, but I got a project to continue and there is an import statement "import oracle.xml.sql.query.OracleXMLQuery;" and this gives me a compilation error...
    What do I need to do, where do I find this class??? Any help?
    //Patricia

    Patricia,
    Did you go through the link
    Re: XML SQL Utility
    You have to put xsu12.jar in the lib directory of the jdev.
    xsu12.jar is in the lib directory of the XDK installation.
    You can download XDK from
    http://www.oracle.com/technology/tech/xml/xdk/software/prod/xdk_java.html
    Just download the XDK kit, get the xsu12.jar from the lib directory and put in the lib directory of the jdev.
    -- Arvind

  • Oracle.xml.sql.query.OracleXMLQuery?

    Anyone know where I can find a java doc or any method infomation on:
    oracle.xml.sql.query.OracleXMLQuery
    thanks,
    chad.

    [from XmlRpc-Java]
    As a result, my XML
    is contained in a String instead of an InputStream.
    It is possible to convert a String to an InputStream using
    StringBufferInputStream, but this class is deprecated in favor of
    StringReader (as StringBufferInputStream does not properly convert
    characters into bytes).
    For the default HTTP transport, an InputStreamReader could be used to
    wrap the InputStream before calling parse().
    Ultimately, the InputStream is converted to an InputSource for use by
    the SAX parser. InputSource will accept a Reader as well.
    [from XmlRpc-Java]
    There should be a way to go from "getXMLString()" to "parse(Reader)" also. In the meantime I'm stuck.
    null

  • ORA-29540: class oracle/xml/sql/query/OracleXMLStaticQuery does not exist

    I am getting below error when trying to generate xml. Browsing on google did not help me. I would appreciate if someone can provide the solution.
    SQL> select dbms_xmlquery.getxml('select * from dual', 2) from dual;
    ERROR:
    ORA-29540: class oracle/xml/sql/query/OracleXMLStaticQuery does not exist
    ORA-06512: at "SYS.DBMS_XMLQUERY", line 19
    ORA-06512: at "SYS.DBMS_XMLQUERY", line 271
    ORA-06512: at line 1

    Then it is probably not the case that you are affected by the issue described in Metalink document 185857.1, but if I were you I would check it anyway, since it might be the problem.

  • Where is the oracle.xml.sql.query package?

    Hi,
    I have downloaded the xmlparser_v2_0_2_9.zip. I hoped I have everything to compile the example for retrieving XML document with an sql query. However, the jar file is missing the entire package oracle.xml.sql.query which contains for instance the crucial class OracleXMLQuery. Does anyone know where I could get this package - is it part of another download that I have to do, or can I buy it anywhere? Thanks for your help.
    Karel

    It's part of the XML SQL Utility for Java, avialable for download from http://technet.oracle.com/tech/xml

  • Java.lang.NoClassDefFoundError: oracle/xml/sql/query/OracleXMLQuery

    Hello, all.
    I get this error message:
    java.lang.NoClassDefFoundError: oracle/xml/sql/query/OracleXMLQuery
    at oracle.xml.xsql.actions.XSQLQueryHandler.handleAction(Compiled Code) ...
    when trying to view an xsql page with the jswdk 1.0.1 web server. (I have no problems when using Web-to-go)
    Classpath includes:
    C:\jdk1.1.8\lib\classes.zip;
    C:\xsql\lib\oraclexsql.jar;
    C:\xsql\lib\xmlparserv2.jar;
    C:\xsql\lib\xsu111.jar;
    C:\xsql\lib\classes111.zip;
    C:\xsql\lib;
    What could be the problem?
    Mateja
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Only thing I can think of is that maybe your server classpath is getting too long. I recall one of the Java Web Server releases having a classpath length limit that caused strange errors like this because that .jar files you thought were on your classpath were getting their path names truncated so the Java VM cannot find the JAR's.
    Try putting xsu111.jar earlier in the list of JAR's and/or try shortening the classpath (perhaps by using SUBST'd drive letters or softlinks on Unix to shorten the path names).<HR></BLOCKQUOTE>
    Putting the xsu11.jar file towards the start of the path did not help.
    I have rewriten the entire bat file that creates the CLASSPATH and starts the server and things now seem to work. There must have been some error in the original bat file, that I just couldn't see.
    Anyway - I thank you for your help.
    null

  • Problem in importing oracle.xml.sql.query.*

    When i am importing this
    import oracle.xml.sql.query.*;
    it is giving me error that
    "package oracle.xml.sql.query.* does not exist".
    What Should i install or set .

    [from XmlRpc-Java]
    As a result, my XML
    is contained in a String instead of an InputStream.
    It is possible to convert a String to an InputStream using
    StringBufferInputStream, but this class is deprecated in favor of
    StringReader (as StringBufferInputStream does not properly convert
    characters into bytes).
    For the default HTTP transport, an InputStreamReader could be used to
    wrap the InputStream before calling parse().
    Ultimately, the InputStream is converted to an InputSource for use by
    the SAX parser. InputSource will accept a Reader as well.
    [from XmlRpc-Java]
    There should be a way to go from "getXMLString()" to "parse(Reader)" also. In the meantime I'm stuck.
    null

  • Error in oracle.xml.sql.query

    I am trying to write small piece of code as
    follows
    import java.sql.*;
    import java.math.*;
    import oracle.xml.sql.query.*;
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    Actual Code
    When i try to compile
    the java file it errors out on Package Oracle.xml.sql.query not found in import
    Pacakage oracle.jdbc.* not found
    Package oracle.jdbc.driver not found
    Is there any files to be installed.
    I installed default Enterprise edition of Oracle 8.1.7 on NT
    Please advise
    Thanks,
    Vidhya
    null

    Have you include classes12.jar/zip, xsu12.jar in your classpath?(assume using JDK 1.2.x)

  • Import oracle.xml.sql.query

    what file do I need to use this class?
    Thanks.

    oracle.xml.sql.query is a package.
    Please refer
    http://www.devx.com/xml/Article/32046

  • Class oracle.xml.sql.query.OracleXMLQuery not found in import

    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Azman Diron ([email protected]):
    I tried to perform load java using a non-sys user :
    loadjava -user user1/passwd -v -o -r Archive.java
    but encountered the following error:
    Errors in Archive:
    ORA-29535: source requires recompilation
    Archive:11: Class oracle.xml.sql.query.OracleXMLQuery not found in import.
    Info: 1 errors
    loadjava: 3 errors
    But if I use sys user I don't have any error:
    loadjava -user sys/manager -v -o -r Arachive.java
    initialization complete
    loading : Archive
    creating : Archive
    resolver :
    resolving: Archive
    Why is this so?
    ANy security setup that I missed?
    Thanks in advance.
    Note:
    my Archive.java file contains:
    // Core Java Classes
    import java.io.*;
    import java.sql.*;
    // Oracle Java classes
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    <HR></BLOCKQUOTE>
    Managed to solve this problem.
    Drop all xml objects owned by sys and user1.
    Reload xml objcets for user1 with -force option.
    null

  • Need Oracle Payroll SQL Query

    Hello,
    I need Oracle Payroll SQL Query with result:
    First_name, Last_name, Payment_amount, Pay_date, Payroll_Frequency, Employement_status
    Any Help would be greatful appreciated

    You will need the following tales.
    per_all_people_f, per_all_assignments_f,pay_run_results,pay_run_result_values
    Query would e something like :
    select papf.first_name,
             papf.last_name,
             prrv.*
    From  apps.per_all_people_f papf
             apps.per_all_assignments_f paaf
             apps.pay_run_results prr,
             apps.pay_run_result_values prrv
    Where papf.person_id = paaf.person_id
    and papf.business_group_id = paaf.business_group_id
    and papf.current_employee_flag = 'Y'
    and paaf.primary_flag ='Y'
    and paaf.assignment_type = 'E'
    and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date
    and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date 
    and prr.assignment_id = paaf.assignment_id

  • What is the process of oracle when SQL query execute

    hi
    I would like to know about process of oracle engine when we are execute a SQL query
    regards

    You can search that either in the Oracle docs or at fine blog http://antognini.ch/blog/ of Chris or in his book. You may also check SQL Tuning by Dan Tow for that matter.
    regards

  • Oracle 8i SQL Query

    I have a table with a hierarchy of business types. A business can be a sub business of another business if the parent's id is in the column PARENT_ID for a particular business. For example:
    ID BUSINESS PARENT_ID
    1 Top level NULL
    2 Second Level 1 1
    3 Second Level 2 1
    4 Third Level 1 2
    Now there is also another table with programs that relates to the business table. For example
    PROGRAM PARENT_ID
    Program 1 2
    Program 2 4
    which means that Program 1 belongs to the business Second Level 1 and Program 2 belongs to Third Level 1 but also belongs to Second Level 1 because Third Level 1 is a sub business of Second Level 1.
    Basically, what I need to do is specify a business and get all of the programs that belong to that business and all of its sub-businesses. How would I build a query to get that? It is an Oracle 8i database that I am remotely accessing via ODBC. Thanks for any help.
    Mark

    Something like this ?
    SQL> select * from business;
            ID NAME                  PARENT_ID
             1 Top level
             2 Second Level 1                1
             3 Second Level 2                1
             4 Third Level 1                 2
    SQL> select * from program;
    NAME        PARENT_ID
    Program 1           2
    Program 2           4
    SQL> select p.name
      2  from PROGRAM p,
      3  (select id from BUSINESS
      4   start with id = 1
      5   connect by prior id = parent_id) b
      6  where b.id = p.parent_id
      7  /
    NAME
    Program 1
    Program 2
    SQL> select p.name
      2  from PROGRAM p,
      3  (select id from BUSINESS
      4   start with id = 2
      5   connect by prior id = parent_id) b
      6  where b.id = p.parent_id
      7  /
    NAME
    Program 1
    Program 2
    SQL> select p.name
      2  from PROGRAM p,
      3  (select id from BUSINESS
      4   start with id = 3
      5   connect by prior id = parent_id) b
      6  where b.id = p.parent_id
      7  /
    no rows selected
    SQL> select p.name
      2  from PROGRAM p,
      3  (select id from BUSINESS
      4   start with id = 4
      5   connect by prior id = parent_id) b
      6  where b.id = p.parent_id
      7  /
    NAME
    Program 2Rgds.

  • 2499 error while executing a Oracle PL/SQL query

    Hi,
    Im a newbie, using Oracle 10g enterprise edition, netbeans 6.5. Im unable to execute a SELECT query which contains multiple JOINS & UNIONS(lengthening upto 3800 chars) through code hence It flashes SP2-0027: Input is too long (> 2499 characters) - line ignored.
    Earlier i had same problem while executing the query on the web interfaced query browser(isqlplus), sqlplus prompt.
    Later on i found a Solution for such queries which are lengthening more than 2499 chars is either to break the query into multiple lines by pressing enter manually or to use M$ Word application (paste the query in a file and save it as a plain text filetype with insert line breaks option checked).
    But what about the coding part now?
    Please guide me through this.
    Regards,
    Peter

    On sqlplus Oracle can't process lines over 2500 (cero is included on the counting) that's the reason why the error is displayed. To sort out this problem divide your query string into parts smaller than 2500 (2000 is recomended) and just add the next line between them:
    CHR(10) || CHR(13)
    Since this is gonna be read by the Oracle's engine and embedded into your query line, it will understand that every pair of CHR(10) || CHR(13) is a carriage return command and will drain the buffer processing every line with not errors.
    Hope this helps
    Edited by: MiloHega on Jan 27, 2009 1:00 PM

Maybe you are looking for

  • Migrate from Exchange 2007 to 2013 without modifying client devices

    Let's use contesso.com as an example.  Let's say the Exchange 2007 server's internal and external name are currently mail.contesso.com.  Now I am going to introduce a new Exchange 2013 server named mail2.contesso.com.  The Exchange Server Deployment

  • Reporting WBS with orders assigned

    We have a WBS elements structure just for planning and budgeting purposes. Each WBS has several type of orders assigned (investments order, and overhead orders) in order to receive all the actual postings. Does someone know if it is possible to see t

  • System9 EPM Architect Process Manager Issue

    Hi, Can somebody help me with Hyperion system9 EPMA issue. I can't able to start the windows services for EPM Architecht Process Manager. I am getting the Following error........ Need some suggestions to fix this. Thanks. Service cannot be started. H

  • Issues downloading and installing Mavericks.

    I am attempting to down load OS X Mavericks and it says there is an error and to try to download it from the purchase page. I try that and my launch shows the icon but says "waiting".

  • FaceTime cannot be installed because the version of Mac OS X is too new.

    The Mac App Store program is telling me I can install FaceTime. I already have it installed, but the version in the App Store is dated last April, whereas my installed version is dated 2013, so it seems like the app store version should be an update.