Help needed in SQL statement

Hi,
From the SQL statement below, i need help in explaining what does the line "WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+))" do?
This statement was written by a vendor and now i have problem displaying some new data. Only a portion of what i need is displayed.
SELECT "LIMS_SYS"."RESULT"."DESCRIPTION",
"LIMS_SYS"."RESULT_TEMPLATE_LIMIT"."NUMERIC_LIMIT",
"LIMS_SYS"."RESULT"."FORMATTED_RESULT",
"LIMS_SYS"."RESULT"."CONCLUSION",
"LIMS_SYS"."RESULT_USER"."U_RESULT_SEQUENCE" ,
"LIMS_SYS"."RESULT"."RESULT_ID"
FROM "LIMS_SYS"."RESULT",
"LIMS_SYS"."RESULT_TEMPLATE_LIMIT",
"LIMS_SYS"."RESULT_USER",
"LIMS_SYS"."ALIQUOT",
"LIMS_SYS"."SAMPLE",
"LIMS_SYS"."SDG",
"LIMS_SYS"."TEST"
WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+)) and
( "LIMS_SYS"."RESULT"."RESULT_ID" = "LIMS_SYS"."RESULT_USER"."RESULT_ID" ) and
( "LIMS_SYS"."SDG"."SDG_ID" = "LIMS_SYS"."SAMPLE"."SDG_ID" ) and
( "LIMS_SYS"."SAMPLE"."SAMPLE_ID" = "LIMS_SYS"."ALIQUOT"."SAMPLE_ID" ) and
( "LIMS_SYS"."ALIQUOT"."ALIQUOT_ID" = "LIMS_SYS"."TEST"."ALIQUOT_ID" ) and
( "LIMS_SYS"."TEST"."TEST_ID" = "LIMS_SYS"."RESULT"."TEST_ID" ) and
( ( LIMS_SYS."SDG"."SDG_ID" = :sdg_id ) AND
( LIMS_SYS."RESULT"."STATUS" <> 'X' ) AND
( LIMS_SYS."RESULT"."REPORTED" = 'T' ) AND
( LIMS_SYS."RESULT_USER"."U_RESULT_CATEGORY" in ( 'Metal' , 'Mean Metal', 'Range Metal')) )
Thanks for all your help.

Hi,
After WHERE .......... is indicates an OUTER Join condition.
In this type of join, system retrieves the data for matched and
as well as unmatched.
Example:
EMP table have a column DEPTNO with the data 10, 20, 30 (total rows=14)
DEPT table have a column DEPTNO with the data 10, 20, 30, 40, 50 (total rows=5)
If the WHERE clause contained EMP.DEPTNO(+) = DEPT.DEPTNO
then the output contain the data relative to 10, 20, 30, 40, 50 (total rows = 16)
i.e. 14 rows (with matching data) and 2 rows (with unmatching data)
Regards,
Sailaja

Similar Messages

  • Need help for the sql statement !!!!!

    hi all,
    i need a sql statement for a query, how can i get the result from the rownum between 100 and 150?
    plz help

    use a scrollable statement:
    PreparedStatement stat = Connection.prepareStement("select * from blah", ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stat.executeQuery();
    rs.absolute(100);
    while (rs.next()) {
    String something = rs.get(1);
    Look into the JDK API reference for ResultSet to get an expalantion of scrollable statements.

  • Need help on my SQL statement

    Hello experts,
    I need to write a dynamic sql statement which will enable users to pick the date and the BI system will take them 3 months back. I tried 3 months variables I kept getting SQL error then I tried 90 days. Now it keep showing that there is no data which for sure I know its not trure.
    This is my statement: +"GL Calendar"."Fiscal Date" >=timestampadd(SQL_TSI_DAY,-90, timestamp'@{ABCcost}{2013-05-16 00:00:00}')AND("GL Calendar"."Fiscal Date">=timestamp'@{ABCcost}{2013-05-16 00:00:00}')+
    Anything that Im missing..

    Rayan,
    I am not sure if I am following you, cause we want to enable the user to pick whatever date and then from there they will get 3 months back and the rest of their info. I tried it didn't work, may be I placed at wrong place
    Can you probably copy my statement above and insert in-between.
    thanks,
    Edited by: 994621 on May 17, 2013 11:28 AM

  • Need help on coverting sql statement to NamedQueries

    hi, all,
    I have a problem on converting the following SQL statement returning last 10 records from an Oracle database.
    The SQL statement is as followings:
    select * from (select * from TABLE1 where ATT1 = 1 order by ATT2 desc) where rownum<11
    However, how should I convert this statement into NamedQuery?
    Thanks.

    Will the following SQL return the same set of rows for you:
    select * from TABLE1 where ATT1 = 1 order by ATT2 desc limit 1,10
    If so, that query is a lot easier to convert.
    I've never tried to convert a subquery into a NamedQuery. The problem is that you're not just converting to named query, but you're also changing from SQL to EJBQL, and they don't map directly even though the semantics are similar.

  • Need a sql statement to remove data?

    Hello,
    I need your help regarding my query.
    I need to put a sql statement in a shell script that will delete records from a table that is > than 3 months old and if not, do nothing.
    The table has a DATE column as shown below:
    LOG_ID NOT NULL VARCHAR2(8)
    LOG_TYPE NOT NULL VARCHAR2(8)
    LOG_MESSAGE NOT NULL VARCHAR2(255)
    LOG_DATE DATE
    I'm a novoice at sql and request you to provide me a sql statement that will do the above.
    Much appreciated!
    Regards,

    SQL> select sysdate from dual;
    SYSDATE
    14-JUL-09
    SQL> select add_months(sysdate,-3) from dual;
    ADD_MONTH
    14-APR-09
    SQL> select add_months(sysdate,-3)-1 from dual;
    ADD_MONTH
    13-APR-09
    DELETE FROM {table_name} WHERE HIREDATE<={pick the date format from above accordingly}

  • Help with an sql statement

    String Queue = jComboBox3.getSelectedItem().toString();
    String Start_Date = jComboBox2.getSelectedItem().toString();
    String End_Date = jComboBox1.getSelectedItem().toString();
    int bins []= new int [size];
    String sql = "SELECT Count(Accepts.Queue)FROM Accepts WHERE Accepts.Queue = 'Queue' And (Accepts.TimeOfAccept Between 'Start_Date' And 'End_Date');";
    ResultSet result = stmt.executeQuery(sql);
    if (result.next())
    int res = result.getInt(1);
    for (int k = size; k<0; k--)
    for (int i = 0; i<res+1; i++)
    bins[i] = res% k;
    Im trying to get information from a table using an sql statement i have converted the items selected in combo boxes into strings and am using these strings in the sql statement but it is still wrong can anyone help me

    . . . WHERE Accepts.Queue = 'Queue' And (Accepts.TimeOfAccept Between 'Start_Date' And 'End_Date')As others have mentioned, it looks like you have a data type mis-match.
    Try:
    . . . . . Accepts.TimeOfAccept Between TO_DATE(Start_Date) AND TO_DATE(End_Date)
    This assumes that the two DATE variables - Start_Date and End_Date - are in standard format - DD-MON-YY.
    If not, you will need to supply a format model as a second argument to the TO_DATE functions:
    TO_DATE(character_string , format_model)
    i.e.
    . . . . . BETWEEN TO_DATE(Start_Date,'MM/DD/YY') AND TO_DATE(End_Date,'MM/DD/YY')
    Hope this helps.

  • Help Needed in SQL QPAC

    Hi there,
    I need some help regarding the SQL QPAC which is a built in QPAC in Adobe Livecycle Workflow. The SQL QPAC takes MYSQL as the default database. Suppose if we need to connect to the SQL Server or any other database, what is the procedure to do that.
    Suraj

    Hi Suraj
    You need to deploy a second copy of the SQL QPAC, and point it at a different datasource. The datasource is defined as a deployment parameter (it will prompt you when you deploy the new version of the qpac).
    You will also need to define the datasource in your application server. This is done in different ways for different application servers - for details, please see: standards_based_qpacs.pdf (part of the Workflow SDK), page 12, "Creating a JNDI datasource".
    Alternately, you can try out our SQLPlus QPAC. This allows you to directly specify connection url, driver, username and password. The SQLPlus QPAC does a lot of other things that the regular SQL QPAC doesn't do, such as handling multiple rows, testing your query, and outputting the data in a variety of ways.
    Details at: http://www.avoka.com/avoka/qpac_library.shtml
    Howard

  • Help needed on income statement query....

    Hello BW gurus,
    I need to make an income-statement query which gives the following output.
    The 5 Variables are                    
         Company Code          
         Plant               
         Fiscal Period     (12 months) in column     
         Value Type               
         Version               
    #ACCOUNT          0METYPE     METYPE-DESCRIPTION     COMPANYCODE PLANT SALES0RG
         Sales               
         Cost of Sales               
         Gross Margin               
         (Sales minus Cost Of Sales)               
         General &Admin               
         Other               
         Operating Income               
         (Gross margin minus G&A minus Other)               
         Interest Income               
         Interest Expense               
         Net Income before Tax               
         (Operating Income minus Interest Income - Interest expense)               
         Taxes               
         Net income               
         (Net Income before Tax minus Taxes)               
    Note: Sales,cost of sales,general and admin,other,interesat income,interest expense,taxes are under the hierarchy of ACCOUNT.
    Please make a quick response.
    100% points will be awarded.
    Thanks in advance.
    Sam Mathew

    Please read these:
    When your query takes too long
    When your query takes too long ...
    How to Post a SQL statement tuning request
    HOW TO: Post a SQL statement tuning request - template posting

  • Urgent ==can somebody help in constructing SQL statement

    Hi,
    I have a table called cgryrel with data and fieldnames like below:
    CGRYREL
    ======
    crpcgnbr crccgnbr
    502 510
    502 511
    502 512
    510 515
    511 516
    512 517
    515 518
    516 519
    517 520
    503 540
    503 541
    I am trying to get a count of rows that are related to crpcgnbr=502.
    To get this information I tried with below SQL statement and ,I get only top level.
    select count(*) from cgryrel where crpcgnbr=502
    result : 3
    I want all rows that are connected to 502?
    can somebody in the forum tell me,what I am doing wrong???
    Thanks
    Jack

    Hi limeybrit9,
    Lluis ...Doesn't that method sort of require that you already know how
    many indentation levels there are if you want all numbers related to
    502?Yes, it does. I already said that in my post. I understand that making a select with, lets say, 100 tables supporting 100 indentation levels might be, at least, ugly to see. But it works and it's fast enough.

  • VCM installation help needed on SQL DB and Reporting server

    Hi All,
    I'm new to VCM and now i got stuck at the SQL DB and Report server portion.
    I'm running the vcm server on VM and the SQL is a physical server, both are sitting on the same LAN.
    I have create the SQL DB but VCM just fail to validate the DB and report server.
    I login to VCM using a Domain account for installation, and i tried to testing the DB using ODBC from the window, result fail.
    Error message as attach.
    I'm now totally lost on SQL portion.
    My Question:
    Is there any configuration needed on SQL DB?
    How to get the reporting server to working?
    What port is needed to it all working??
    VCM server Ms Win2012.
    SQL version 2012.
    Many thanks to all who reply.

    Hi Simonhoo79,
    For SSRS,   first check whether the report server link is accessible from your browser : "http://s01-fes-vcm1:80/ReportServer" . If you continue to get 404 error there also, then you need to reconfigure you report server first before proceeding to vcm installation. Follow the steps on below link on how to reconfigure report server using report services configuration Manager for 404 error.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/75910bcb-a879-4eb7-9757-acc45201fa3a/can-not-connect-to-reportserver-http-404-file-not-found?forum=sqlexpress
    For SQL server ODBC connection,
    Dont create ODBC connection for SQL Native Client. Create ODBC connection for SQL Server.
    1. Open ODBC Data Source Administrator
    2. Click User DSN tab and Click Add button.
    3. Select SQL server and click finish
    4. Give name and description and Give the SQL server name (with instance name if your using named instance) or IP in the Server text box.
    5. Click Next and select either Windows authentication or sql authentication based on your SQL server authentication mode and click next.
    6. If the details given are correct then it will proceed further and  check "Change the dafault database to" to your VCM database
    7. Click next and finish and try test data source.
    VCM 5.7.2 and below will support installation only on windows server 2008 R2  and it doesn't support windows server 2012  but it support both 2008 and 2012 sql servers.

  • Help needed in SQL performance - Using CASE in SQL statement versus 2 query

    Hi,
    I have a requirement to find count from a bunch of tables.
    The SQL I have gives the count of all members.
    I have created 2 queries to find count of active and inactive members.
    The key difference is only the active dates.
    Each query takes 20 seconds to execute.
    I modified the SQL to use CASE statement in the SELECT.
    So after the data is fetched the CASE statement will evaluate the active date and gives 2 counts (active and inactive)
    Is it advisable to use this approach. Will CASE improve SQL performance ? I have to justify this.
    Please let me know your thoughts.
    Thanks,
    J

    Hi,
    If it can be done in single SQL do it in single SQL.
    You said:
    Will CASE improve SQL performance There can be both cases to prove if the performance is better or worse.
    In your case you should tell us how it is.
    Regards,
    Bhushan

  • Need help in a sql statement

    Hi, I have some data like the following and I need to get only one row instead of two.
    Current data:
    ID                       Time_Type                       Time
    A_xyz Check_In 2009-02-11 07:00 AM
    A_xyz Check_out 2009-02-12 10:00 AM
    I want it in the following format:
    ID                       Check_in_Time                           Check_out_time
    A_xyz 2009-02-11 07:00 AM 2009-02-12 10:00 AM
    There are about 10 more fields in the table but all other data is same except for the time. Thanks for your help.

    Hi, Yes, I already had queries using max but then I found that I could not use them as I don't know how many time_types there would be. I appologize I should have mentioned this in my first post and had posted some additional info.
    In my example time_types are as check_in and check_out but infact the types are codes and they don't tell if they are check in or check out. All I need is to convert the rows into columns. I can call my columns col1, col2 etc instead of check_in_time and check_out_time.
    Also, I am giving you guys an example but it is exactly same as our real data.
    Thanks again.

  • Need help about distributed sql statement

    Hello everybody
    Enviroment:
    Oracle 11g R1.
    This Database was fine, 'till some days ago that a new system was deployed on other database. New system runs some SELECT querys to a my database using db_links. These statements are blocking some resources and 'cause that they are blocking many users of my database. I can see on Enterprise Manager this wait event : "enq: TM contention".
    Now my question is, why are these querys are blocking resources and users if they are only of type SELECT??? I thought that querys that did this were DML and DDL statements.
    Does this behavior is related with that those querys are executed by a distributed way (using dblinks)??
    Thanks a lot

    user652447 wrote:
    Distributed Transactions require commit even if a Select. See the following FAQ post from Jonathan Lewis for some basic information.
    http://www.jlcomp.demon.co.uk/faq/dblink_commit.html
    HTHNot always true though, it depends. The article you are linking to is quite old and covers, as stated, Oracle version(s): 7.0 – 9.2. Whereas the OP is on 11.
    http://download.oracle.com/docs/cd/B10500_01/server.920/a96521/ds_txns.htm
    In the section "Read-Only Response"
    Note that if a distributed transaction is set to read-only, then it does not use rollback segments. If many users connect to the database and their transactions are not set to READ ONLY, then they allocate *rollback space* even if they are only performing queries.
    In the OP's version
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/ds_txns003.htm#ADMIN12226
    Note that if a distributed transaction is set to read-only, then it does not use undo segments. If many users connect to the database and their transactions are not set to READ ONLY, then they allocate *undo space* even if they are only performing queries.
    However that doesn't account for the types of lock the OP is experiencing.

  • Help Needed In SQL Query

    HI All,
    Oracle sql clarification required
    Sample Table:
    empno empname Job mgr_id hire_date salary deptno
    7788 SCOTT ANALYST 7566 19-APR-87 3000 20
    7902 FORD ANALYST 7566 03-DEC-81 3000 20
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    7900 JAMES CLERK 7698 03-DEC-81 950 30
    7369 SMITH CLERK 7902 17-DEC-80 800 20
    7876 ADAMS CLERK 7788 23-MAY-87 1100 20
    Need "single / one" sql for this requirement statement:
    There will be 2 drop down boxes (1st - Job list, 2nd - empno) in the form in which the following result set is expected
    1) When user selects value from 1st drop down box (job) as "ANALYST" leaving the second drop down unselected, the result expected is 2 (no. of rows for that job)
    2) When user selects value from 1st drop down box (job) as "ANALYST" and the value from 2nd drop down box as 7902, the result expected is 1 (no of rows for that job and empno)
    Sqls which I have tried from my side (given below) didn't give the expected result and please do help me in correcting this
    select count(1) from scott.emp where job='ANALYST' and ( empno = :empno or empno is null ) ;
    Please help for this requirement. Any help is deeply appreciated.
    Thanks
    Zaheer

    Hi,
    welcome to the forum.
    Please read SQL and PL/SQL FAQ
    When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    For your question the following will both work:SQL> select * from emp
    where job='ANALYST' and (empno =:empno or :empno is null)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    SQL> select * from emp
    where job='ANALYST' and empno =NVL(:empno, empno)
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7788 SCOTT ANALYST 7566 19/04/1987 00:00:00 3000 20
    7902 FORD ANALYST 7566 03/12/1981 00:00:00 3000 20
    2 rows selected.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Help needed for SQL query

    hello ,
    I am a beginner in terms of writing sql queries. I hope some body can help me out.
    I have two tables
    mysql> desc user_group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | userAccountId | char(8) | | PRI | | |
    | groupId | char(8) | | PRI | | |
    ---------------------------------------------------+
    2 rows in set (0.00 sec)
    mysql> desc group_t;
    ---------------------------------------------------+
    | Field | Type | Null | Key | Default | Extra |
    ---------------------------------------------------+
    | id | char(8) | | PRI | | |
    | name | char(50) | YES | | NULL | |
    | email | char(100) | YES | | NULL | |
    | description | char(254) | YES | | NULL | |
    | parentId | char(8) | YES | | NULL | |
    | creatorId | char(8) | YES | | NULL | |
    | createDate | char(20) | YES | | NULL | |
    | updateDate | char(20) | YES | | NULL | |
    | updatorId | char(8) | YES | | NULL | |
    ---------------------------------------------------+
    9 rows in set (0.00 sec)
    what I want is list of all groups with id,name and #of members(which is the # of rows in the user_group_t for any given id). Importantly I need the groups with 0 members also to be listed. In short my output should contain exactly the same number of rows as in group_t table with an additional column indicating # of members for that group.
    Any help would be greatly appreciated.
    Thanks in Advance.
    -Vasanth

    Thanks Donald,
    Actually I figured it out, with the following query:
    select id,name,sum(if(groupid is not null,1,0)) as members from group_t left join user_group_t on id=groupid group by id;
    I tried your solution, but mysql says there is an error at '+' . Anyway I modified your solution to the one below and it worked.
    select a.id, a.name, count(b.groupid) from group_t a left join user_group_t b on a.id=b.groupid group by a.id, a.name;
    I tried that before but then I used Count(*) instead of count on groupid. Your solution is elagant and I will go with yours.
    Thanks again.
    Vasanth

Maybe you are looking for

  • Reverting to old backup

    My phone was in for repair and so I backed it up before sending it away, however when I attempted to restore it the cable came out and when I reinserted it the phone synced with my itunes and created a new backup of my wiped phone and therefore seems

  • How do you change the tempo of a track?

    Question is pretty self explanatory in the title...

  • Trouble using getLong to get an Oracle Number(8,2) field from ResultSet

    I am having trouble using getLong to get an Oracle Number(8,2) field from ResultSet. The error message starts with: java.lang.ExceptionInInitializerError: [exception was kaffe.utilNotImplemented] at oracle.jdbc.dbaccess.DBConversion.NumberBytesToLong

  • Error in commitment update in SO

    Hi Experts, While creating a sales order I am getting an error as " Error in commitment update. Status being set. The order can not be delivered/billed." Please help me out.

  • Apache Xerces2  XML parser download?

    Hello all, where can i find Apache Xerces2 XML parser download? Seems not working http://xerces.apache.org/xerces2-j/download.cgi http://xerces.apache.org/xerces2-j/ thank you. I really need it. I am stuck with that bug: http://bugs.sun.com/bugdataba