Error Sub select

Hello People!!
I have a problem here!
I doing this select and im receiving an erro in every line "a.batch"...can you help me please??
SELECT a.trial_id,
a.trial_description,
a.tube_type_description,
a.department_description,
a.trial_status,
a.batch_id,
a.batch_description,
a.estimated_amount,
a.start_date,
a.end_date,
a.batch_status,
b."qty_tubes_collected",
c."qty_tubes_rejected",
          d."percent"
FROM
     trl_report_status_tmp a,
     (select count(e.product_type) "qty_tubes_collected"
from trl_batch_tube e
where e.batch_id = a.batch_id) b,
(select sum(f.quantity) "qty_tubes_rejected"
from trl_reject_hourly_trial f
where f.batch_id = a.batch_id)c,
(select (sum(g.quantity) / count(h.product_type)) "percent"
from trl_reject_hourly_trial g,
trl_batch_tube h
where g.batch_id = a.batch_id
and h.batch_id = a.batch_id)d ;
ERROR at line 27:
ORA-00904: invalid column name
Thank you...
Alessandro Falanque

No....it doesnt.....
here is the original code from sybase :
SELECT
     a.*,
     (SELECT
     Count (tube_type)
     FROM
     tb_batch_tube
     WHERE
     batch_id = a.batch_id) as qty_tubes_collected,
          (select sum(quantity)
from trial..tb_reject_hourly_trial
where batch_id = a.batch_id) as qty_tubes_rejected,
               isnull(convert(float,(select sum(quantity)
                                                                           from trial..tb_reject_hourly_trial
                                                                           where batch_id = a.batch_id))/(select count(tube_type)
from tb_batch_tube
where batch_id = a.batch_id),0) as percent
FROM
     #tb_report_status a
Can you see a way to convert it to PL/SQL, because i will open it with a REF CURSOR.....
thank you!

Similar Messages

  • Sub-Select SQL query in Oracle BI Answers

    Hi
    What's the proper usage of Sub-Select SQL query in Oracle BI Answers Version Oracle Business Intelligence 10.1.3.2.1?
    I get [SQL_STATE: HY000] [nQSError: 10058] A general error has occured when trying to Sub Select query like:
    itemno = (SELECT MIN(orders.itemno) FROM mydatabase where rownum < 2 order by orders.itemno)

    Maybe the best is to create a new physical and logical object for your sub-select and join this with your current objects.

  • XML-22009: (Error) Attribute 'select' not found in 'xsl:value-of'

    Hello,
    I'm a long-time Siebel developer but novice to BIP, trying to enhance some complex rtf templates that an experienced xdo/bip developer (contractor) designed for us in the past, with a couple of new fields that have been added to the integration object.
    All templates and sub-templates receive 'no errors found' when using add-in tool selection of 'Validate Template'. Unfortunately we cannot utilize the 'preview' capability due to the way the sub-templates are called, so only way to test is to upload into server and attempt to run real-time.
    This results in UI error of SBL-OMS-00203, which when we dig into the xdo log file turns out to be:
    <Line 648, Column 88>: XML-22009: (Error) Attribute 'select' not found in 'xsl:value-of'.
    I have exported all templates and sub-templates into XSL-FO Style Sheet and looked at line 648 column 88, and none of them seem to correspond to this line/column combination (in fact most exports do not even go that high in lines).
    Googling 'XML-22009' hasn't proven to be of much help, so reaching out to the xdo experts in this forum.
    How are the line/column #'s determined in the xdo log output?
    I am pretty sure that it must be some issue with my 'Main' template, since none of the sub-templates have been changed (and the current version of the report, without the new fields incorporated, still runs fine from the UI). In the XSL-FO format export of the (modified, with new fields added) 'Main.rtf' file, line 648 places it right in the midst of a bunch of hex which corresponds to an imbedded image (which was also part of the existing template, no change there) and that line only has 65 columns (i.e. doesn't even go up to 88), so I'm questioning how valid the Line/Column information is in the xdo log error message.
    Any hints on troubleshooting this one would be greatly appreciated!
    Thanks & Regards,
    Katrina

    Hi,
    as I wrote in the inital message, we even left out the output method or used "application/pdf". The result is unfortunately always the same. And I still claim this is not a problem with the stylesheet itself, it has to do something with the mobile's environment.
    Something I didn't tell: we have 2 servlets in our application, 1 responsible for output in html and 1 in pdf. The .fo stylesheet passed to the 'html servlet' is parsed correctly (and shows the source code, because it does not know about fo and conversion to pdf), the .xsl stylesheet passed to the 'pdf servlet' raises same exception/same line. You might tell us that there is a problem with the 'pdf servlet', but once again: why in online it is working?
    Greetings and thanx very much for your precious time!

  • Sub select in Oracle

    We have procedure in MSSQL where we use sub select. I was
    wondering if there is a way to implement it in Oracle. I tried
    creating one , but failed . Any helpwill be appreciated.
    /*IN ORACLE*/
    create or replace package testpkg as
    type r1rec is record
    (name test1.name%type,
    age test2.age%type);
    type r1RefCur is ref cursor return r1rec;
    Procedure testproc
    (r1ref In OUT r1Refcur);
    end;
    create or replace package body testpkg as
    Procedure testproc
    (r1ref In OUT r1Refcur) is
    begin
    open r1ref for
    select name,(select age from test2) from test1;
    end;
    end;
    null

    Anish,
    Here are a couple of pointers:
    select empno, (select dname from dept) dname from emp
    ERROR at line 1:
    ORA-01427: single-row subquery returns more than one row
    SQL> select empno, (select MAX(dname) from dept) dname from emp
    2 ;
    EMPNO DNAME
    2 SALES
    7499 SALES
    7521 SALES
    This is a new feature so may not be available in all
    circumstances. (eg it may not work in the cursor statement you
    suggested)
    There is an older way of doing it:
    SQL> select empno, d.mdname from emp, (select MAX(dname) mdname
    from dept) d;
    EMPNO MDNAME
    2 SALES
    7499 SALES
    Otherwise a conversion into a more frequently used type syntax
    may be required select col1, col2 from tab1, tab2 where ....
    [the where clause may need a bit of thought]
    I hope this is of some help
    Turloch
    Oracle Migration Workbench Team
    Anish (guest) wrote:
    : We have procedure in MSSQL where we use sub select. I was
    : wondering if there is a way to implement it in Oracle. I tried
    : creating one , but failed . Any helpwill be appreciated.
    : /*IN ORACLE*/
    : create or replace package testpkg as
    : type r1rec is record
    : (name test1.name%type,
    : age test2.age%type);
    : type r1RefCur is ref cursor return r1rec;
    : Procedure testproc
    : (r1ref In OUT r1Refcur);
    : end;
    : create or replace package body testpkg as
    : Procedure testproc
    : (r1ref In OUT r1Refcur) is
    : begin
    : open r1ref for
    : select name,(select age from test2) from test1;
    : end;
    : end;
    Oracle Technology Network
    http://technet.oracle.com
    null

  • Sub-selects in forms causing ora-24333

    We are running in a new 11g environment and are receiving an ora-24333 from forms with sub-selects. The same form works in 10g and the sql statement, itself, works in sqlplus. The following is an example of code
    exec_sql.parse(oracle_handle, oracle_cursor,
    'update vendor a
    set (status, vendor_type) =
    (select decode(rec_sttus,'||''' '''||','||'''ACTIVE'''||',
    '||'''I'''||','||'''INACTIVE'''||',
    '||'''D'''||','||'''DELETE'''||',
    '||'''F'''||','||'''FOREIGN'''||',
    '||'''N'''||','||'''RENUMBERED'''||',
    '||'''K'''||','||'''KEEPER'''||',
    rec_sttus),
    vndr_type
    from prch_vndr b
    where a.vendor_no = b.vndr_num)
    where vendor_no in
    (select vndr_num
    from prch_vndr)');
    t_temp := exec_sql.execute(oracle_handle, oracle_cursor);
    exec_sql.parse(oracle_handle, oracle_cursor, 'commit');
    t_temp := exec_sql.execute(oracle_handle, oracle_cursor);
    Any ideas where we might have a configuration setting missing or what has changed with 11g forms of which we are unaware?
    Edited by: kwalker on Dec 26, 2012 2:00 PM
    Edited by: kwalker on Dec 26, 2012 2:00 PM

    Hi Kelly,
    We are running in a new 11g environment and are receiving an ora-24333 from forms with sub-selects. The same form works in 10g and the sql statement, itself, works in sqlplus. The following is an example of codeAlways post code snippets in &#123;code&#125; tags as explained in FAQ.
    >
    exec_sql.parse(oracle_handle, oracle_cursor,
    'update vendor a
    set (status, vendor_type) =
    (select decode(rec_sttus,'||''' '''||','||'''ACTIVE'''||',
    '||'''I'''||','||'''INACTIVE'''||',
    '||'''D'''||','||'''DELETE'''||',
    '||'''F'''||','||'''FOREIGN'''||',
    '||'''N'''||','||'''RENUMBERED'''||',
    '||'''K'''||','||'''KEEPER'''||',
    rec_sttus),
    vndr_type
    from prch_vndr b
    where a.vendor_no = b.vndr_num)
    where vendor_no in
    (select vndr_num
    from prch_vndr)');
    t_temp := exec_sql.execute(oracle_handle, oracle_cursor);
    exec_sql.parse(oracle_handle, oracle_cursor, 'commit');
    t_temp := exec_sql.execute(oracle_handle, oracle_cursor);Any ideas where we might have a configuration setting missing or what has changed with 11g forms of which we are unaware?>
    a. EXEC_SQL package for simple updates looks like an overkill. EXECUTE IMMEDIATE will meet the requirement.
    b. The ORA-24333 error is related to data. Is the database and schema for 10g, SQLDeveloper and 11g the same? If they are different then check data in the database/schema used with Forms 11g.
    Cheers,

  • Is `WHERE` clause pointless inside a sub-select?

    WHERE is part of the definition of a sub-select:
    [WITH [<calc-clause> ...]]
    SELECT [<axis-spec> [, <axis-spec> ...]]
    FROM [<identifier> | (< sub-select-statement >)]
    [WHERE <slicer>]
    [[CELL] PROPERTIES <cellprop> [, <cellprop> ...]]
    < sub-select-statement > :=
    SELECT [<axis-spec> [, <axis-spec> ...]]
    FROM [<identifier> | (< sub-select-statement >)]
    [WHERE <slicer>]I understand that a subselect does not reduce dimensionality or set context.
    If overall context of a script is not driven via a sub-select then is there ever a point in using this WHERE clause in the subselect? 
    An example in Adventure Works:
    SELECT
    [Measures].[Order Count] ON 0
    [Geography].[Country] * [Product].[Category] ON 1
    FROM
    SELECT
    [Geography].[Country].[Australia] ON 0
    FROM [Adventure Works]
    WHERE
    [Product].[Category].[Bikes]

    Hi WhyTheQ,
    According to your description, you want to know if the Where clause is working when the main select statement is not driven via the sub-select. Right?
    In MDX, Where clause is used for defining slicer axis so that only the data intersecting the with the specified member will be returned. It will work in the sub-select to restrict the data. However, the return result from sub-select should match
    the set on your axis. In this scenario, your sub-select returns an aggregation value of a dimension member, but in your main select row level expects a tuple set. So your can't get the result and it will throw error.
    Reference:
    Specifying the Contents of a Slicer Axis (MDX)
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Insert Using SELECT & Sub-SELECT

    Hi All,
    I am trying to insert records into a table using SELECT statement. The SELECT statement has a Sub-SELECT statement as follows:
    INSERT INTO table1(c1,c2,c3,c4,c5)
    SELECT c1,c2, (SELECT MAX(C3)+a1.c3
    FROM table1
    WHERE c1 = var1
    AND c2 = a1.c2
    GROUP BY c3),c4,c5,
    FROM table1 a1
    WHERE c1 = var1
    The above works fine when run from SQL*PLUS but gives compilation error when included in PL/SQL pacakge.
    I am using Oracle 8.1.7.
    Could you any one please tell me if I have missed something?
    Thanks,
    Satyen.

    In 8i, you will need to use dynamic SQL to execute this statement because the PL/SQL parser does not understand all SQL syntax (including SELECT in a column list).
    execute immediate
      'INSERT INTO table1(c1,c2,c3,c4,c5)' ||
      ' SELECT c1, c2, (SELECT MAX(C3)+a1.c3 FROM table1 WHERE c1 = :var1 AND c2 = a1.c2 GROUP BY c3), c4, c5' ||
      '   FROM table1 a1 WHERE c1 = :var1' using var1, var1;

  • Sub Select list within the Select List!!

    Hi All,
    I want one solution, i want to have a sub select list within the select list, i mean i want to have a dropdown shown when we point a cursor on any of the Value of
    the select list. Sub select list for that value of the select list.
    Hope you all got it,Please Reply me if anybody has the solution, I am using APEX version 3.0.1.00.07
    Thanks

    Hm,
    Service Unavailable
    The proxy is currently unable to handle the request due to a (possibly) temporary error. Extended error information is:
    * Failed to forward the request to the web server at apps.oraclecorp.com:80. This may be due to a firewall configuration error or a DNS failure.
    If this situation persists, please contact your security gateway administrator.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    ------------------------------------------------------------------------------

  • Aggregate Sub-Selects

    OK, this is probably only for the more advanced.
    I have a query that gives me an (ORA-000979) Not a Group By Expression whenever I have a sub-select in the select clause that has an aggregate function.
    For Example, the following:
    SELECT
    Items.A,
    SUM(Items.B * Items.C) As D,
    Inventory.A,
    Warehouses.A,
    (SELECT
    Sum(InventoryAudit.Qty)
    FROM
    InventoryAudit
    WHERE
    InventoryAudit.Item_ID =
    InventoryMain.Item_ID)
    FROM
    Inventory,
    Items,
    Warehouses
    WHERE
    ITEMS.A = 4
    AND Warehouses.A = Items.D
    Group By
    Items.A,
    Inventory.A,
    Warehouses.A
    null

    Braden,
    As moonriver pointed out, you are missing the InventoryMain table in your from clause in your inner sub-query.
    You also don't have enough join conditions in your outer query. You have three tables in your outermost from clause: inventory, items, and warehouses. Bearing in mind that the minimum number of join conditions required to join n tables is n-1, then to join 3 tables, you need at least 2 join conditions, but you only have 1 join condition. Every table in the from clause must be joined, but you haven't provided a join condition for the inventory table. You need to join the inventory table to either the items table or the warehouses table.
    In the code below, I have placed two dashes -- in front of each line that I added where your code was missing a line. This is just a start. There may be other errors. It would help to have the structure of your tables and an explanation and example of the results you are trying to achieve.
    SELECT Items.A,
    SUM (Items.B * Items.C) As D,
    Inventory.A,
    Warehouses.A,
    (SELECT SUM (InventoryAudit.Qty)
    FROM InventoryAudit
    -- , InventoryMain
    WHERE InventoryAudit.Item_ID = InventoryMain.Item_ID)
    FROM Inventory,
    Items,
    Warehouses
    WHERE ITEMS.A = 4
    AND Warehouses.A = Items.D
    -- AND Inventory.? = ?.?
    GROUP BY Items.A,
    Inventory.A,
    Warehouses.A;Barbara
    null

  • Custom Hierarchy sub selection from BEx Query to Webi

    Hi All,
    The client has requested that from a hierarchy only certain accounts / account nodes be brought into the Webi report.
    I have made a Account Number Filter in the BEx query containing the nodes that the client has requested. In order to get a hierarchical view, I activated the hierarchy display through BEx and selected the hierarchy the the selection of the nodes came from.
    I ran the report through Analyzer and all works - the only nodes that show are the nodes that were filtered on through query designer and all lower nodes below it. It displays as a hierarchy properly.
    When running in Webi, I bring in the hierarchy object for Account number and the report crashes giving me the general Webi error. (I have added a screenshot).
    In conclusion, what I am trying to do is take a sub selection of certain account nodes from a hierarchy and display those nodes with all lower levels below in a hierarchy. It works in BEx, not in Webi.
    If this won't work in Webi, any idea how to build this in BEx so it will work in Webi?

    I haven't tried this myself yet - but did you register your Google API key?  Please see Google Maps in SDK Extension

  • Getting javascript error while selecting the Recipients in OBIEE delivers.

    Hi All,
    I am working on OBIEE from quite a long time, but recently I came across a error while selecting the Recipients in Recipients list of OBIEE delivers.
    Making it more comprehensive, when I try to create an ibot , after entering all necessary information when I select Recipients in Recipients list and click on ok. I get a JavaScript error "null" is null or an object. The surprising thing is when i select cancel it works as ok.
    Any help will be highly appreciated
    Thanks,
    Jyoti
    Message was edited by:
    user616430

    I think you dont have a field named /BIC/XXXXXX in the table from which you are trying to fetch the data. Chech the spelling of the field name and table name.

  • Error while selecting entity for composantEO

    Hi,
    Briefly, I do an example of displaying a list of components (and already it works properly), but when I added a link to the removal of components I have encountered an error
    Voila details
    function code delete
    public void deleteComposantMethod(String action,String param)
    System.out.println("Now we are inside deleteComposantMethod");
    System.out.println("we search composant with numcomp : "+param);
    ComposantVOImpl inst=getComposantVO1();
    Row row[]=inst.getAllRowsInRange();
    for(int i=0;i<row.length;i++)
    ComposantVORowImpl rowi=(ComposantVORowImpl)row;
    System.out.println("checking the composant ===> "+rowi.getNumcomp());
    if(param.equals(rowi.getNumcomp().toString()))
    try{
    rowi.remove();
    getOADBTransaction().commit();
    System.out.println("Deleting succes");
    catch(Exception ex)
    System.out.println("error : \n"+ex.getMessage());
    return;
    in the browser page component disapru it seems that it works correctly, but nothing changes at data base and voila the error message I get from embedder OC4J server log
    Application: FND, Message Name: FND_GENERIC_MESSAGE. Tokens: MESSAGE = oracle.jbo.DMLException: JBO-26080: Error while selecting entity for ComposantEO
    thanks
    Please note: although no board code and smiley buttons are shown, they are still usable.
    thanks

    Hi,
    for those who have encountered the same problem as me, you should check that the table name sql query is of the form Name_Schema.Name_Table.
    For this right click on the entity in the workspace> edit entity> Database Objects> Schema Objects and add the schema name before table name( Name_Schema.Name_Table).
    thanks,

  • Error while selecting date from external table

    Hello all,
    I am getting the follwing error while selecting data from external table. Any idea why?
    SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
      2        SE_CUST_ID NUMBER(38),
      3        SE_TRAN_AMT_LCY FLOAT(126),
      4        SE_REVERSAL_MARKER VARCHAR2(255))
      5  ORGANIZATION EXTERNAL (
      6    TYPE ORACLE_LOADER
      7    DEFAULT DIRECTORY ext_tables
      8    ACCESS PARAMETERS (
      9      RECORDS DELIMITED BY NEWLINE
    10      FIELDS TERMINATED BY ','
    11      MISSING FIELD VALUES ARE NULL
    12      (
    13        country_code      CHAR(5),
    14        country_name      CHAR(50),
    15        country_language  CHAR(50)
    16      )
    17    )
    18    LOCATION ('SE2.csv')
    19  )
    20  PARALLEL 5
    21  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> select * from se2_ext;
    SQL> select count(*) from se2_ext;
    select count(*) from se2_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04043: table column not found in external source: SE_REF_NO
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
    HTH -- Mark D Powell --

  • Error while selecting entity

    Hi
    I keep getting the "JBO-26080: Error while selecting entity for Units" error. Below is the query in my View Object. If I remove the Units(Enitty) from the query it works fine but I need to have that in the query. This error occurs only when I do "Reset" on the screen which in turn calls "getSearchProgramView().getCurrentRow().refresh(Row.REFRESH_WITH_DB_FORGET_CHANGES);"
    Can some one explain how to get rid of this problem? When I run the query in TOAD it works fine.
    SELECT Programs.PROGRAM_ID,
    Programs.CATEGORY,
    Programs.NAME,
    Programs.PROGRAM_COORDINATOR_ID,
    Programs.PROGRAM_ASSISTANT_ID,
    Programs.MANAGING_UNIT_ABBR,
    Programs.CREATED_BY,
    Programs.CREATED_DATE,
    Programs.LAST_UPDATED_BY,
    Programs.LAST_UPDATED_DATE,
    Persons.PERSON_ID,
    Persons.USER_NAME,
    Persons.FIRST_NAME,
    Persons.LAST_NAME,
    Persons1.PERSON_ID AS PERSON_ID1,
    Persons1.USER_NAME AS USER_NAME1,
    Persons1.FIRST_NAME AS FIRST_NAME1,
    Persons1.LAST_NAME AS LAST_NAME1,
    Categories.NAME AS NAME2,
    Categories.CODE AS CODE1,
    Units.DESCRIPTION,
    Units.CODE
    FROM PROGRAMS Programs, PERSONS Persons, PERSONS Persons1, CATEGORIES Categories, UNITS Units
    WHERE ((Programs.PROGRAM_COORDINATOR_ID = Persons.PERSON_ID(+))
    AND (Programs.PROGRAM_ASSISTANT_ID = Persons1.PERSON_ID(+))
    AND (Programs.CATEGORY = Categories.CODE(+))
    AND (Programs.MANAGING_UNIT_ABBR = Units.CODE(+)))
    Thanks

    Hi,
    for those who have encountered the same problem as me, you should check that the table name sql query is of the form Name_Schema.Name_Table.
    For this right click on the entity in the workspace> edit entity> Database Objects> Schema Objects and add the schema name before table name( Name_Schema.Name_Table).
    thanks,

  • Load data error: Database selection with invalid cursor (sm21)

    hi experts,
    when I execute processchar, it occur some system error:
    "Database selection with invalid cursor ",
    "Documentation for system log message BY 7 :
    The database interface was called by a cursor (in a FETCH or CLOSE
    cursor operation) that is not flagged as opened. This can occur if a
    COMMIT or ROLLBACK was executed within a SELECT loop (which closes all
    opened cursors), followed by another attempt to access the cursor (for
    example, the next time the loop is executed). "
    the error msg occur when apply bw support package19.
    data from DSO to CUBE, Transferred Recodes is not zero, but Added Recodes is zero.
    Request status always yellow, process is running.
    current sys info: BI7 and BW19, BASIS17,PI_BASIS17, the database is oracle10g R2.
    thanks for your help.

    I have solved this issue, The Oracle checkpoint not complete.
    thanks,
    xwu.

Maybe you are looking for

  • 2 Macs sharing an external hard drive, but can't see each other's music

    We bought a 300GB Lacie external hard drive, and pointed each Mac's iTunes to the same folder on that drive. Then the computer asked to "consolidate," which means copying all the music on each to that shared folder--which is great so far. But then in

  • How do I configur a 4350 USB?

    The 4350 shows up on Measurement & Auto Explorer. And appears to be functioning. Under properties I selected the accessory as 2190. This is the TC interface which is connected. In the test panel the Thermocouples are responding to stimulus. However,

  • Why won't my iMessage or any other browsing or date work?

    Usually when my iMessage won't work or I can't use any browsing data, such as checking emails or using safari, restarting my phone will allow me to use iMessage and browse when it turns back on. However, today I restarted it numerous times and it sti

  • Connecting OxyGuard Model 420 - Dissolved Oxygen Sensor- to FieldPoint 1601 , FP-AI-110 analog input

    Hello, i have OxyGuard Model 420 (Dissolved Oxygen Sensor 4-20 ma) that i want to connect to my FieldPoint 1601 , FP-AI-110 analog input. i'm using LabView 7.1 this sensor have 2 wires, and i dont want to make mistakes and destroy the sensor, how i c

  • Identification of Mapping program at runtime

    Hi, I have a requirement in which based upon the value in a particular field I need to call the different mapping program. I already have the different scenrios with these mapping programs, now that if the value is "A", it needs to call the mapping p