Problem creating a hierarchical tree in the generator of forms [problem with the query]

Hi all

I have 2 tables.

box (box_id, box_name)

point (item_id, nom_element, box_id)

There are several items in a box.

I want to create a HIERARCHICAL tree to display items that are present in each box.

AS:

| - BOX1
| |-ITEM 1
| | - ITEM 2
|
| - BOX2
| |-ITEM 1
| | - ITEM 2

I'm trying this query:

SELECT-1 State, box_name, box_id, "icon" val
in zone b, point i;

I don't know what the value for upgrade, I don't know how the code part "connect by front.

Could you please tell me?

Michael.

PS. then I'll eventually use this query in the form designer.

Hi MichaelR

I'm getting the FRM - 47321 error in forms Builder...

That's why In order to fill a tree, the select must recover 5 columns:
STATUS, LEVEL, LABEL, ICON, u-VALUE should be noted this command in your application, this will resolve the error and pls notice that the...

My advice is to use the online help in your form generator to help u in this...

Initial state : number
Node tree depth : number
Label for the node : varchar2
Icon for the node : varchar2
Data : varchar2

This must be a TIME NEW FORM INSTANCE trigger to fill your tree...

Another thing why do you think of building your tree I've done here in the following example... Pls take a look here....

I hope this helps...

Kind regards

Amatu Allah.

Tags: Oracle Development

Similar Questions

  • Dynamic problem with lookup-query for the purpose of resource request

    Hi all
    I need to set up several IOM user exchange mailboxes, I can set up AD account and account of the mailbox without any problem, but only for the first ad and Exchange account. For the second and third, etc. I get the error: "Invalid login name" during Exchange of account provisioning. I discovered that this problem exists with Exchange Connector - it is not able to collect correct GUID. So in my xml Dataset I use dynamic query Lookup to select manually correct Alias, the login name and GUID. The query for the GUID is the sequel (I cloned RO for AD and Exchnage):

    AttributeReference available-in-bulk = "true" length = "32" widget = 'search query' type = 'String' attr-ref = "Object GUID" name = "Object GUID" >
    * < lookupQuery search-query = "select distinct UD_KFUSER_OBJECTGUID GUID, ud_KFUSER_uid like UD_KFUSER UD_KFUSER, orc orc Login, sta sta where UD_KFUSER.orc_key = orc.orc_key and orc.usr_key = ' $Form data." Take ' and UD_KFUSER. "UD_KFUSER_AD = 27 and orc.orc_status = STA.sta_status AND STA.sta_bucket! = 'Cancelled'" display-field = "GUID" save-field = "Object GUID" / > *.
    * < / AttributeReference > *.


    My questions are:

    1. I have to type * to run the query in the user interface, without * I got error:

    + < 17 February 2012 11:12:22 THIS > < error > < oracle.adfinternal.view.faces.config.ric +.
    h.RegistrationConfigurator > < BEA-000000 > < ADF_FACES - 60096:Server Exception durin
    PPR, #10 g
    oracle.iam.platform.canonic.base.NoteException: an error occurred during executin
    g the search query.
    to oracle.iam.platform.canonic.agentry.GenericEntityLookupActor.perform)
    GenericEntityLookupActor.java:337)
    Is this right?

    2. when I got correct values (from the search query) - they are missing on the details of the application and form of RO - what Miss me?

    I use OIM 11.1.1.5, in my xml dataset I use correct attr-Ref (labels), when I type the values manually, they are propagated to form RO and Exchange mailbox is created.
    Best
    MP

    I not had no problem when writing search query.
    This works very well for me.
    The request will be filled for the field, so why choose *?
    I used as

  • What is the problem with this query in the source

    A blank page is region 2. Region1: enter rec_no (-rec_no is varchar2) region2:hide and show that displays one record based on rec_ no region1 entered.
    The problem is that I get the following error

    ORA-06550: line 1, column 7: PLS-00428: an INTO clause in this SELECT statement

    Here's my simple query in a process of pl/sql
    Start
    Select rec_no, rec_name from mytable where rec_no = upper(:P16_rec_no);
    end;

    Why? The same query works under the sql command.

    what I'm trying to accompolish here, it is because he has given huge if I want to display hide also multiples, regions and allow users to update each region as a result. Help, please. It kills me that I just can't understand what is causing the problem to the query. Thank you.

    Hello

    The list is set to the field EMPLOYEE_ID itself? What is the primary key of the table? In my example, DEPTNO is the primary key and I used the element generated by the wizard page to display the list. The parameters of the Source of the item itself or the column DEPTNO and database so that the process "process line...". "to identify the updated row.

    Andy

  • Confusion between the performance problem with a query

    I have a query that takes 3 minutes (according to another developer, but when I run it not even returned after 10 minutes) to return lines nil. But the interesting part is that instead of select * if I give a count (*) select, he returned in less than a second. And even the subquery returns no rows in less than one second. The query is as follows. I see no option to answer this confusing behavior. Please suggest me an option I can verify, what explains this scenario. I am interested to know the root cause of it. Please let me know if you need any details.
    select * from order_lines_flmnt_stg_in ol
     WHERE order_lines_flmnt_stg_in_id IN (
              SELECT DISTINCT order_lines_flmnt_stg_in_id
                         FROM order_lines_flmnt_stg_in ol,
                              order_header_flmnt_stg_in oh,
                              order_lines oln
                        WHERE ol.TYPE = 'Original'
                          AND ol.item_code NOT IN (
                                 SELECT oln.item_code
                                   FROM order_lines oln,
                                        order_lines_flmnt_stg_in ol,
                                        order_header_flmnt_stg_in oh
                                  WHERE oh.po_id = ol.po_id
                                    AND ol.item_code = oln.item_code)
                          AND (    ol.error_message IS NULL
                               AND oh.error_message IS NULL
                               AND oh.activate_flag = 1
                              ));
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Sep 30 16:41:53 2009
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    
    SQL> set lines 10000
    SQL> alter session set current_schema = epix;
    
    Session altered.
    
    SQL> set timing on
    SQL>           SELECT DISTINCT order_lines_flmnt_stg_in_id
      2                       FROM order_lines_flmnt_stg_in ol,
      3                            order_header_flmnt_stg_in oh,
      4                            order_lines oln
      5                      WHERE ol.TYPE = 'Original'
      6                        AND ol.item_code NOT IN (
      7                               SELECT oln.item_code
      8                                 FROM order_lines oln,
      9                                      order_lines_flmnt_stg_in ol,
     10                                      order_header_flmnt_stg_in oh
     11                                WHERE oh.po_id = ol.po_id
     12                                  AND ol.item_code = oln.item_code)
     13                        AND (    ol.error_message IS NULL
     14                             AND oh.error_message IS NULL
     15                             AND oh.activate_flag = 1
     16                            );
    
    no rows selected
    
    Elapsed: 00:00:00.11
    SQL> select count(*) from order_lines_flmnt_stg_in ol
      2   WHERE order_lines_flmnt_stg_in_id IN (
      3            SELECT DISTINCT order_lines_flmnt_stg_in_id
      4                       FROM order_lines_flmnt_stg_in ol,
      5                            order_header_flmnt_stg_in oh,
      6                            order_lines oln
      7                      WHERE ol.TYPE = 'Original'
      8                        AND ol.item_code NOT IN (
      9                               SELECT oln.item_code
     10                                 FROM order_lines oln,
     11                                      order_lines_flmnt_stg_in ol,
     12                                      order_header_flmnt_stg_in oh
     13                                WHERE oh.po_id = ol.po_id
     14                                  AND ol.item_code = oln.item_code)
     15                        AND (    ol.error_message IS NULL
     16                             AND oh.error_message IS NULL
     17                             AND oh.activate_flag = 1
     18                            ));
    
      COUNT(*)
    ----------
             0
    
    Elapsed: 00:00:00.18
    SQL> select count(*) from order_lines_flmnt_stg_in;
    
      COUNT(*)
    ----------
          3198
    
    Elapsed: 00:00:00.18
    SQL> 
    I don't know if it's relevant, but there are no locks on the tables involved.

    Published by: release 6' - 8 "September 30, 2009 16:49

    count (*) SELECT can use the index only without having to consult the table at all...
    Amiel

  • PROBLEM WITH SQL QUERY.

    Hi all

    I am executing the following query, which I use to retrieve unique records.


    SELECT OH. ORDER_ID, OH. ORDER_DATE, OH. GRAND_TOTAL, OSI. DESCRIPTION ACE ORDER_STATUS,
    PMT. DESCRIPTION AS PAYMENT_METHOD, TR. AS PAYMENT_STATUS DESCRIPTION
    OF ORDER_HEADER OH INNER JOIN ORDER_PAYMENT_PREFERENCE OPP ON OH. ORDER_ID = OPP. ORDER_ID and
    OPP. CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)
    PAYMENT_METHOD_TYPE PMT, STATUS_ITEM SO, STATUS_ITEM OSI
    WHERE OPP. PAYMENT_METHOD_TYPE_ID = PMT. PAYMENT_METHOD_TYPE_ID AND
    OPP. BATCH = IF. BATCH AND OH. BATCH = OSI. BATCH AND
    (OH. BATCH = "ORDER_CREATED" | OH. BATCH = "ORDER_HOLD") AND
    OH. "CREATED_STAMP > = ' 2011-12-03 11:41:04.

    Problem I am facing is, for some a few order_ids we have several entries in ORDER_PAYMENT_PREFERENCE with CREATED_DATE even where query return me of duplicate records.
    I applied OPP. "CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)' forced to get the record, unique, but as I said to few recordings, we have several lines in ORDER_PAYMENT_PREFERENCE corr. ORDER_ID single and multiple records have same CREATED_DATE.

    Can you suggest a few changes, the query to retrieve unique records.

    I know I'm a very abstract information, shortly I'll provide table structure and little info I want in this query.
    It's because of the tight work schedule.


    Thank you
    Jagdeep Singh

    Hello

    Basically, you need to convert a number in his order inside each created_date order_payment_preference. However, if you have more than one created_date which is him even you'll actually choose one of them at random unless you specify an order more squeezed by the clause. For example, you might have a numeric value from a sequence that could be added to determine which input was really the most recent. In any case the following should give you an idea what I mean...

    SELECT
          order_id,
          order_date,
          grand_total,
          order_status,
          payment_method,
          payment_status
    FROM
        (
            SELECT oh.order_id,
                   oh.order_date,
                   oh.grand_total,
                   osi.description AS order_status,
                   pmt.description AS payment_method,
                   si.description AS payment_status
                   ROW_NUMBER() OVER(PARTITION BY opp.order_id ORDER BY opp.created_date DESC) rn
            FROM   order_header oh
                   JOIN order_payment_preference opp ON oh.order_id = opp.order_id
                   JOIN payment_method_type pmt ON opp.payment_method_type_id = pmt.payment_method_type_id
                   JOIN status_item si ON opp.status_id = si.status_id
                   JOIN status_item osi ON oh.status_id = osi.status_id
            WHERE
            AND    oh.status_id IN('ORDER_CREATED','ORDER_HOLD')
            AND    oh.created_stamp >= '2011-12-03 11:41:04'
        )
    WHERE
         rn = 1    
    

    Some notes if - it is not a good idea to mix the styles of the junction between ansi and oracle style, it makes it difficult to follow. Just choose one or the other.

    OH.STATUS_ID='ORDER_CREATED' || OH.STATUS_ID='ORDER_HOLD'
    

    Makes no sense. I took a guess that you meant, OR then I converted to an IN clause that will do the same job.

    HTH

    David

  • problem with a query

    Hello experts,

    I know that is not the exactly the right forum but I'm having some trouble in a query
    select retailer_num, retailer_name 
    from lotto_retailers 
    where agent_status_id = 2
    and salesrepid= :criteria.rep_id
    UNION
    SELECT '0', '**ALL**'
    FROM lotto_retailers 
    where agent_status_id = 2
    and salesrepid= :criteria.rep_id
    ORDER BY 1
    I created a text field in the forms of oracle with a list of values

    I want to have an option "ALL" where it will select all retailer_num based on my salesrep_id condition.this does not seem to work.
    can someone help please

    Thank you

    You look at something like this:

    select retailer_num, retailer_name
    from lotto_retailers
    where agent_status_id = 2
    and salesrepid= (CASE WHEN upper(:criteria.rep_id) = 'ALL' then salesrepid ELSE :criteria.rep_id END)
    ORDER BY 1
    
  • Problem with a query of xmlt

    Hello

    I need to query this xml file:

    < a > < action id = "1" > < alarm id = "1000" > 3 < / alarm > < alarm id = '1001' > 2 < / alarm > < alarm id = "31" > 2 < / alarm > < / action > < Code action = "3" > < alarm id = "16" > 5 < / alarm > < / has >

    I need to add the action/@id attribute to this query:
    select aa.hour,
           to_number(extract(value(xa),'alarm/@id')) alm_,
           to_number(extract(value(xa),'alarm/text()')) freq_
      from t_alarm_stats aa,
           xmltable('$XML/a/action/alarm' passing aa.x_alarm AS "XML") xa
     where aa.id_device = 3194
       and aa.hour > trunc(sysdate-1);
    I have now the recordset is fine enough:

    time, id_alarm and frequency of the alarm:
    28/03/2011 01:00 1000 3
    28/03/2011 01:00 1001 2
    28/03/2011 01:00 31 2
    28/03/2011 01:00 16 5

    I need to also add the corresponding action/@id, but I don't know how to navigate to a higher level of my xml so that the Recordset:

    time, action id, id_alarm and frequency of the alarm:
    28/03/2011 01:00 1 1000 3
    28/03/2011 01:00 1 1001 2
    28/03/2011 01:00 1 31 2
    28/03/2011 01:00 3 16 5

    Y at - it the possibility to do this with 1 query?

    Thanks in advance,
    Samuel

    Hello

    This should do it:

    select aa.hour
         , xa1.action_id
         , xa2.alarm_id
         , xa2.alarm_freq
    from t_alarm_stats aa,
         xmltable('$XML/a/action'
           passing aa.x_alarm AS "XML"
           columns action_id number  path '@id',
                   alarms    xmltype path 'alarm'
         ) xa1,
         xmltable('/alarm'
           passing xa1.alarms
           columns alarm_id   number path '@id',
                   alarm_freq number path '.'
         ) xa2
    where aa.id_device = 3194
    and aa.hour > trunc(sysdate-1)
    ;
    
  • Problem with select query that includes a date

    I fought with it for about 4 hours - Yes, quite literally... I was never good with stuff to date. I have a brain block.

    In any case, here's the situation:

    I have an Access database that has a date/time field. There is no time, just a date in the format dd/mm/yyyy.

    This table is a list of classes held for three years. I want to do a query that displays only the classes that have completed after January 1st of this year. I don't want to put the 01/01/2010 in the query itself because I want it to work again next year.

    It's the current query:

    < name cfquery = "classes" datasource = "" #DSN # "dbtype ="ODBC">"

    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit

    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime WE classes.classTime = classTime.timeID) INNER JOIN owners WE classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType

    WHERE the classes.classEnd < 01/01 / #DatePart ("yyyy", now())) #.

    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle

    < / cfquery >

    I don't get any results, but I should get a list of each class that has an end date before 1 January of this year - about 200 cases.

    When I swap around the place where clause:

    < name cfquery = "classes" datasource = "" #DSN # "dbtype ="ODBC">"

    SELECT classesTitles.ClassTitle, classesTitles.ClassDesc, classCatagories.catagoryName, classes.classStart, classes.classEnd, classes.classNotes, owners.fName, owners.lName, classTime.timeSlot, classes.classID, classes.classLimit

    FROM classCatagories INNER JOIN (((classes INNER JOIN classesTitles ON classes.classTitle = classesTitles.classTitleID) INNER JOIN classTime WE classes.classTime = classTime.timeID) INNER JOIN owners WE classes.classInstructor = owners.ownerID) ON classCatagories.catagoryID = classesTitles.ClassType

    WHERE classes.classEnd > 01/01 / #DatePart ("yyyy", now())) #.

    ORDER BY classes.classStart, classCatagories.catagoryName, classTime.timeSlot, classesTitles.ClassTitle

    < / cfquery >

    I get EACH class in the database, and I should get only about 50

    The classes are long about 8 weeks, the dates of beginning and end are in the database in the form of date/time fields, so I need to show everything that ends in 2010, regardless of when it began.

    I'm sure it's something pressing, but he's avoiding me.

    Thank you

    Michelle

    Your field format date in access is irrelevent to the situation at hand.  Use objects appropriate date instead of trying to build an appropriate string.  On 1 January of the current year, the createdate() of coldfusion functions and year() now() are your friends.  Then, a message from Adam was not clear, use cfqueryparam with the resulting variable.

  • What is the problem with this query? My head is numb!

    Can someone tell me why this request;

    < cfquery datasource = "manna_premier" name = "qGetstats" >
    SELECT the user name,
    UserFirstName,
    UserLastName,
    LastLogin,
    TotalLogins,
    UserZone,
    TM_Name
    USERS
    WHERE UserID = ' #. TM_log UserID # '.
    < / cfquery >

    generates this error message;

    Run database query error.

    [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Too few parameters. 1 expected.
    The error occurred in D:\Inetpub\mannapremier\TM_log_report2.cfm: line 28
    26 :         TM_Name
    27 : FROM Users
    28 : WHERE UserID = "#TM_log.UserID#"
    29 : </cfquery>
    30 : 
    

    SQLSTATE07002
    SQLSELECT the user ID, UserFirstName UserLastName, LastLogin, TotalLogins, UserZone, TM_Name FROM USERS WHERE UserID = '10120.
    VENDORERRORCODE-3010
    DATASOURCEmanna_premier

    I see that my variable WHERE comes through but the domain name is not working. I'm sure that the answer is obvious, but it drives me crazy!

    Help, please!

    I tried and got this result;

    No, you now use different data. Now, the user ID is empty, while she was 10120 first.

    The only problem seems to be double quotes. To check this, test with

    WHERE UserID = 10120
    

    I'm assuming that the userID field to be an integer. If it is text, then use single quotes (not!), as in

    WHERE UserID = '#TM_log.UserID#'
    
  • What is the problem with this query?

    Hello

    I need some advice on how to change the following query (with perhaps some analytical function) to speed it up. Currently, it takes 6 + minutes. This query is executed in response to a request from the front-end application and 6 + min is certainly unacceptable.

    I am trying to provide as much information I can think, but if more information is needed, please let me know.

    I have a table called "wave_result". It contains millions of rows. PK is Wave_Id, Version_nbr, node_nbr and prod_nbr. For each 'wave_id + node_NBR + prod_nbr' there are several versions (version_nbr). In the following query, I try to extract a line with MAX version_nbr for combination of ' wave_id + node_NBR + prod_nbr.

    H3. Request:
    SELECT ip1.fnln_cat,
                ip1.sub_cat,
                ip1.bus_cat,
                NVL (SUM (ip1.lsu), 0) val
        FROM ideal_prod ip1, ideal_store s, wave_result wr
       WHERE  wr.wave_id = 51
             AND wr.prod_nbr = ip1.prod_nbr
             AND wr.wave_id = ip1.wave_id
             AND wr.version_nbr =
                    (SELECT MAX (wr1.version_nbr)
                       FROM wave_result wr1
                      WHERE   wr1.wave_id = wr.wave_id
                            AND wr1.node_nbr = wr.node_nbr
                            AND wr1.prod_nbr = wr.prod_nbr)
             AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add'
             AND s.wave_id = wr.wave_id
             AND s.node_nbr = wr.node_nbr 
    GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat
    H3. Rank of charges:
    ========
    "wave_result" is the largest table with millions of rows.
    Table                Total Rows       Rows for wave_id = 51
    Ideal_prod           188K             38K
    Ideal_store          3K               574
    Wave_result          90M              19M
    H3. Stats
    are updated almost daily by the DBA (not sure if that's a good or bad).

    H3. Explain the Plan:
    =========
    SELECT STATEMENT ALL_ROWS Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
         12 HASH GROUP BY Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
              11 VIEW VIEW SYS.VM_NWVW_2 Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
                   10 FILTER 
                        9 HASH GROUP BY Cost: 330,737 Bytes: 2,425,603 Cardinality: 14,881 
                             8 HASH JOIN Cost: 327,183 Bytes: 41,233,784 Cardinality: 252,968 
                                  1 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKIDEAL_STORE Cost: 4 Bytes: 13,202 Cardinality: 574 
                                  7 HASH JOIN Cost: 327,178 Bytes: 35,415,520 Cardinality: 252,968 
                                       5 HASH JOIN Cost: 198,619 Bytes: 18,764,328 Cardinality: 183,964 
                                            3 TABLE ACCESS BY INDEX ROWID TABLE APAPOPR.IDEAL_PROD Cost: 939 Bytes: 2,272,380 Cardinality: 37,873 
                                            4 TABLE ACCESS FULL TABLE APAPOPR.WAVE_RESULT Cost: 197,063 Bytes: 7,974,414 Cardinality: 189,867 
                                       6 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKWAVE_RESULT Cost: 82,467 Bytes: 721,495,854 Cardinality: 18,986,733 
    H3. Sample data:
    ===========
       For wave_id = 51
                     there are 28466854 rows in "wave_result" table
    
       For wave_id = 51 and node_nbr = '0201' and  prod_nbr = '0226960'
                     there are 3 rows in "wave_result" table
    H3. Version of database information are below to:
    =========================
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE            11.1.0.7.0                        Production
    TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Thank you very much!!

    Concerning
    For wave_id = 51
                     there are 28466854 rows in "wave_result" table
    
       For wave_id = 51 and node_nbr = '0201' and  prod_nbr = '0226960'
                     there are 3 rows in "wave_result" table
    

    As you mentioned that this particular request is called by a front screen, how different search criteria you get it to show on the front end?
    Assuming that if the user is searching just of wave_id = 51 which lines returns to 28466854, it is certainly not a good approach to go look up many records to put end Front end is very light and can not hold many records and will be finally the web server will throw off out of memory exception. Always a limit on the number of records that you retrieve from the database and display it on the front plane.
    OR
    The second case where the user makes a search by wave_id, node_nbr and prod_nbr, even if she returns to 3 lines, behind the scens, he still made a full scan on the wave_result table. If we go with analytical function, we can reduce a sweep of extra table on the wave_result table. Also the table has millions of lines and the max (version_nbr) seems to be a frequently used on this table sub query. While inserting a record into the table wave_result, you must probably have a calculated value that will tell you its value max and you will choose just the rank of this value, instead of at each time max(). something like below...

    SELECT ip1.fnln_cat,
                ip1.sub_cat,
                ip1.bus_cat,
                NVL (SUM (ip1.lsu), 0) val
        FROM ideal_prod ip1, ideal_store s, wave_result wr
       WHERE ipl.wave_id = 51
             AND wr.prod_nbr = ip1.prod_nbr
             AND wr.wave_id = ip1.wave_id
             AND wr.wave_id = s.wave_id
             AND wr.node_nbr = s.node_nbr
             AND wr.precomputed_max_value = 'MAX'
             AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add'
    GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat;
    
  • Creating a column blank for the query.

    Hi all

    I have a query which translates like this

    A (col1) B (Col2) C (Col3)
    1 90 x

    But I want to add an extra empty column at the end as D (Col4). My query is joined by tables 6 and 7. So please can someone help with that.

    Thank you
    Sri

    Sri,

    Do you mean something like this:

    select emp,deptno,name,NULL other from employee;
    

    Other this is a column_name that does not really exist in the framework, but can be used in queries.

    See you soon,.
    Manik.

  • Problem with SQL query in the view of a line

    Hello

    I have a table TABLEA it has 3 columns:

    Structure of TABLEA

    Code Tax_Code_1 Tax_Code_2

    1A
    1 B


    I want that the output voltage:

    Code Tax_Code_1 Tax_Code_2
    1 A AND B

    Any help will be necessary for me

    Thanks and greetings

    ..

  • What is the problem with this query? exception does not work.

    DECLARE
    v_employee_id EMPLOYEES. EMPLOYEE_ID % TYPE;
    v_last_name EMPLOYEES. LAST_NAME % TYPE;
    v_salary EMPLOYEES. % SALARY TYPE.
    e_invalid_emp EXCEPTION;
    BEGIN
    SELECT last_name, salary v_employee_id, v_last_name, v_salary, employe_id
    EMPLOYEES where employee_id = & employee_id;

    IF SQL % NOTFOUND THEN
    RAISE e_invalid_emp;
    END IF;

    DBMS_OUTPUT. Put_line(v_employee_id||) e '|| v_last_name | » '|| v_salary);

    EXCEPTION
    WHEN e_invalid_emp THEN
    DBMS_OUTPUT. Put_line ("' employee not found...");
    END;
    /
  • problem with a query with clause

    Hello

    I am facing a problem, so I describe a little:
    create table schoolboys (
    id integer,
    name varchar2(20)
    /
    
    create table marks (
    schoolboy_id integer,
    mark integer,
    mark_type char(1))
    /
    
    create table avg_marks (
    schoolboy_id integer,
    avg_mark number (5,2)
    )
    /
    
    
    insert into A values (50, 9, 'N');
    insert into A values (50, 7, 'N');
    insert into A values (50, 6, 'T');
    insert into A values (88, 9, 'N');
    insert into A values (88, 7, 'N');
    insert into A values (88, 10, 'T');
    insert into A values (20, 4, 'N');
    insert into A values (20, 5, 'N');
    insert into A values (20, 3, 'N');
    insert into A values (20, 5, 'T');
    and I make this request for several insertion in another table
    INSERT INTO avg_marks 
               (schoolboy_id, 
                avg_mark) 
    (SELECT   schoolboy_id, 
              (Avg(Decode(mark_type,'T',NULL,
                                    mark)) * 3 + Sum(Decode(mark_type,'T',mark, 
                                                                      0))) / 4
     FROM     marks 
     GROUP BY schoolboy_id);
    But what I want is to insert in avg_marks that records where the
    ((Avg(Decode(mark_type,'T',NULL,
                                    mark)) * 3 + Sum(Decode(mark_type,'T',mark, 
                                                                      0))) / 4) > 5
    So, I want to limit inclusion in avg_marks.
    If there are results with (avg (decode...)) < 5 these files, I want to be inserted into another table, with the same columns as avg_marks
    How should I code this? What should I use?
    I tried with
    with t as(
    (SELECT   schoolboy_id,
              ((Avg(Decode(mark_type,'T',NULL,mark)) * 3 
              + Sum(Decode(mark_type,'T',mark,0)) / 4))>5) MARK
    from MARKS
    )
    INSERT INTO avg_marks
               (schoolboy_id,
                avg_mark) values (t.schoolboy_id, t.MARK)
     
    ORA-00923: FROM keyword not found where expected
    Best regards

    Edited by: Roger22 the 18.06.2009 11:36

    fix

    No, not at all sure you insert records into a table, then another! ;) Do you mean an multi-table insert, i.e. two INSERTs in the transaction?

    INSERT FIRST
      WHEN avg_mark >= 5 THEN
        INTO avg_marks (schoolboy_id,  avg_mark)
        VALUES (schoolboy_id, avg_mark)
      WHEN avg_mark < 5 THEN
        INTO avg_marks2 (schoolboy_id,  avg_mark)
        VALUES (schoolboy_id, avg_mark)
      SELECT   schoolboy_id,
              (Avg(Decode(mark_type,'T',NULL,
                                    mark)) * 3 + Sum(Decode(mark_type,'T',mark,
                                                                      0))) / 4 avg_mark
        FROM     marks
     GROUP BY schoolboy_id;
    
  • Problems with Sub query

    Hello, I'm looking to create a sub query to display certain information. On the form that the information is entered, the user has the option to enter a phone number extension, as appropriate. If this is the case, I want the phone number to show as 555-867-5309 (x 1234). However, without the problem of controls, the (x) will be displayed without worrying and seems sloppy. Here is the code I have, please notify.

    There will be two places, it will be necessary - for the telephone number of the applicant and the app (SME) contact information manager.

    Thank you.

    select
        pm.pk_proj_master_id "Project Number",
        pm.trackit_work_order "TrackIt Work Order",
        pm.name "Project Name",
        pm.status "Project Status",
        req.last_name||', '||req.first_name||', '||req.middle_initial||'.' "Requestor Name",
        rde.department_group_descr "Requestor Department Name",
        req.department_descr "Requestor Division Name",
        
        pm.requester_ext,
        case
            when pm.requester_ext in 
                (
                select 
                    pm.requester_phone|| '(x'||pm.requester_ext ||')' "Requesters Number"
                from 
                    protrac_master pm
                where
                    pm.requester_ext is not null
                )
            
            else
                (
                select
                    pm.requester_phone "Requesters Number"
                from 
                    protrac_master pm
                )   
        end as "Requester Number",
         
        man.last_name||', '||man.first_name||', '||man.middle_initial||'.' "SME Name",
        mdg.department_group_descr "SME Department Name",
        man.department_descr "SME Division Name",
        
        pm.app_manager_ext,
        case
            when pm.app_manager_ext in 
                (
                select 
                    pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')' "SME Number"
                from 
                    protrac_master pm
                where
                    pm.app_manager_phone is not null
                )
            
            else
                (
                select
                    pm.app_manager_phone "SME Number"
                from 
                    protrac_master pm
                )   
        end as "Requester Number",
    
        pm.createby_date "Date Entered",
        pm.date_begin "Date Began",
        pm.date_completed "Date Completed",
        pm.estimated_date "Estimated Completion Date"
    
    from
        protrac_master pm,
        cobr.vw_pps_payroll req, cobr.department_group rde,
        cobr.vw_pps_payroll man, cobr.department_group mdg
        
    where
        pm.requester_id         = req.emple_no and
        pm.requester_dept_id    = rde.pk_department_group_id and
        pm.app_manager_id       = man.emple_no and 
        pm.app_manager_dept_id  = mdg.pk_department_group_id
        
    order by 
        pm.pk_proj_master_id

    I think you can avoid the sub query thing simply by using the NVL2 function:

    select ...
         , NVL2( pm.requester_ext
               , pm.requester_phone|| '(x'||pm.requester_ext ||')'
               , pm.requester_phone) "Requesters Number"
           ...
         , NVL2( pm.app_manager_ext
               , pm.app_manager_phone|| '(x'||pm.app_manager_ext ||')'
               , pm.app_manager_phone) "Manager Number"
           ...
      from protrac_master pm
         , ...
    

Maybe you are looking for

  • How can I move the main library of FCPX sys HARD drive to another HARD drive

    I am a beginner FCPX... I use an SSD as diss system. I n ' love to load this SSD with such a library. Is it possible to move the main library on another hard drive? A big thank you to you all Michel

  • Geen snelkoppeling

    HP photosmart geiinstalleerd printer works prima alleen squeeze ik het niet Center solution in beeld ik vind hem ook niet genoeg completely in software list? geprobeert opnieuw you installeren lukt ook niet CD open (squeeze close in beeld IPV openen

  • Control digital I / O on USB-6009-OEM

    Hello. I use a USB-6009 OEM in a project I'm working on that. And I have a quick question regarding controlling the i / O on the acquisition of data. Currently, to be able to control each IO individually, I open a task for each e/s to the beginning o

  • Can't turn on my firewall.

    I was wondering why I can't turn on my firewall. I have windows Vista on a laptop Dell Vostro 1700. I have webroot antivirus with antispyware 'Required by the work' and it doesn't tell me if it is a firewall program.  I turn on my windows firewall, b

  • WHEN I CLICK MY MOUSE RIGHT IT WON'T SAVE - AS?

    When I go to save a picture or file, I right click the mouse and nothing happens, nothing comes on the screen why?