Validate a value based on another

Hello

I have a table structure

xx_IMP_TBL

(Number RECORD_ID,

STATUS varchar2 (20).

Number DELIVERY_ID,

Number DELIVERY_DETAIL_ID,

Number QUANITY_TO_SHIP,

PALLET_NO varchar2 (20).

LPN_NO varchar2 (20).

Number ORGANIZATION_ID)

Now I have a scenario where I'm also insert 6 rows and the value of delivery_is is the same for all rows but delivery detail will change.

Now I'm inserting a value of pallet_no (P12345). Now there I must assure you that for a given delivery id the palette must remain the same

If they are not then I have to report the error. to accomplish this, I have to write a select statement in the statement. So far I have cam to the top with the following query

SELECT COUNT (DELIVERY_ID)

-BY lv_waybill_cnt

OF xx_IMP_TBL

WHERE delivery_id = 36780655

AND pallet_no = 'P12345"HAVING

(Delivery_id) count = COUNT (PALLET_NO);

but it is not giving me the desired result. Could someone help me with this query? I use 11g

Thank you

If I understand correctly, you want to find delivery_id values that have more than one pallet_id associated with them.  If so, then:

Select delivery_id, pallet_count County (separate pallet_id)

of gsi_3pl_shpconf_imp_tbl o

where delivery_id = 36780655

Delivery_id group

having count (distinct pallet_id) > 1

For a unique delivery_id, this is trivial, but if you remove the predicate on delivery_id or provide a list of values delivery_id you can find all occurrences.

John

Tags: Database

Similar Questions

  • AF:Switcher, handfuls of line column values based on another column in the table

    Hello

    I have a question if you can help me on this. It's on af:switcher.

    What I'm trying to do this - is in a table of the adf, based on the value of a column, I want another column to display as a link or not.
    For example, if the status column is 1, then the id column display as a link (I just put a h:outputLink around outputText to do), if it is then show him without bond.

    For this I put two different facets and opportunities switcher to decide what facet of show which line.

    BUT what is happening is that only on opportunities is made. Either / or scenario. It is not made each line according to the value of the status column.

    What is planned.

    I just tried with the dept table.

                    
                    
                    
                      
                    
                    
                    
                        
    
                      
                    
    

    The lines for which the deptno > 20, I wanted to display the pass as link and for the deptno<=20, log="" will="" be="" an="" input="" text.="" it="" works="" fine="" for="" me.="" probably,="" you="" may="" need="" to="" get="" rid="" of="" h:outputlink="" and="" use="" commandlink="" golink="">

    Arun-

  • Best way to select distinct values, based on another column?

    I have a table with three columns: id (NUMBER), data_dt (DATE) and data_value (NUMBER).
    There is a primary key id and data_dt.

    I want to choose the folder with the last data_dt for each unique identification number.

    What is the best way to do it?
    I have three different methods, but there may be something that I am missing.

    First of all:
    SELECT *
    FROM
    (
      SELECT id, data_dt, data_value,
             FIRST_VALUE(data_dt)
             OVER (PARTITION BY id ORDER BY data_dt DESC) AS last_data_dt
      FROM the_table
    )
    WHERE data_dt = last_data_dt;
    (I use ORDER BY... DESC, instead of just ORDER BY I don't need the clause BETWEEN the LINES)


    Second:
    SELECT t1.*
    FROM the_table t1
    JOIN
    (
      SELECT id, MAX(data_dt) AS last_data_dt
      FROM the_table
      GROUP BY id
    ) t2 ON (t2.id = t1.id AND t2.data_dt = t1.data_dt);
    Third:
    SELECT t1.*
    FROM the_table t1
    WHERE t1.data_dt =
    (
      SELECT MAX(t2.data_dt)
      FROM the_table t2
      WHERE t2.id = t1.id
    );
    -Don

    As mentioned in hoek, you will need to test all scenarios.

    However, in my opinion the more faster will be those who accesses the table that only ONCE instead of TWICE as some scenarios require.

    HTH!

  • Get the cumulative values in a single column based on another column in reports

    Hi all

    I have a requirement to get cumulative values based on another column.
    I 'Sales rep name' in the first column.
    Correspondent "Values of the invoice line" in the second column.
    Want to have cumulative of all the values for each sales invoice line.
    Then apply rank and display the top 10 sales reps based on invoice lines.
    Since there is no rank option in the PivotTable, I do this in the report table.

    Looking for the best entries...

    Thanks in advance...

    Try below
    2nd column: "name of Sales rep.
    column 2: SUM ("invoice line values ' BY 'Name of Sales rep'") and sort this field desc.
    3rd column: fx RANK (SUM ("invoice line values" BY "Sales rep name")), to hide this column, so that you don't confuse your users.

    and put the filter on the 3rd column below 5

    I hope this works for you

  • Fill a field value based on the value of another field

    Hello
    Could someone tell me what is the problem with the following select statement. For a group of records, trying to fill a field with a value based on the value in another field (problem of status), but the Group of records appears empty just when I put this code in the field.
    Any help would be appreciated
    Thank you


    <? choose:? >
    <? When: IssueStatus = "Open"? >
    <? 1? >
    <? end when? >
    <? otherwise:? >
    <? When: IssueStatus = "closed"? >
    <? 2? >
    <? end when? >
    <? otherwise:? >
    <? When: IssueStatus = "Unresolveable? >
    <? 3? >
    <? end when? >
    <? end otherwise? >
    <? end to choose? >

    Use the following syntax.

    
    
    Display 1
    
    
    Display 2
    
    
    Display 3
    
    
    
  • Default value for the prompt based on another request

    Hello:

    I have a requirement where I need to define default values of messages based on another request.

    The guest is a quick Date.

    I have tried using the presentation variable and sql query writing, where is written "WHERE promo_id = @{variable}" "

    but it still does not.

    Please let me know a workaround for this problem.

    Thank you.

    -Vinay

    What determined your operator BETWEEN End Date? I guess it's variable. In addition, is the second report on the same page or another page of dashboard? Assuming that the two reports are on the same page, do the below. If this isn't the case, you can use the same guests on the second page of dashboard. Define the scope of "dashboard" and the selection of the user is wearing on the second page.

    The easiest way is to have 3 guests of dashboard: Promo_ID, Start_Dt and end_date. assign to these guests PVs: pvPromoID, pvStartDate and pvEndDate, respectively.

    Filter a report on pvPromoID and pvStartDate.

    The second report on the pvPromoID of the filter and use pvStartDate in the filter of the two report Date column. Assuming that the values BETWEEN are variable, so you can write the following on the column of your second report:

    "Table name". " Date ColumnName.<= '@{pvstartdate}'="" and="" table="" name"."date="" column="" name"=""><>

    And your Promo column, use the filter "Table name". "Class = ' @{pvPromoID}"

    When the user selects the Promo ID, Start Date and end Date in the guests, the first and second reports will be filtered accordingly.

  • Based on another selection LOV LOV

    Hello

    Apex Version: 4.2

    I struggled to get a LOV to be based on the selected value of an another LOV on the same page without submitting the page.

    For example. I have two LOV ' page.

    The first is a LOV region and the second is a LOV box.

    I want the list returned by the LOV area to include only the areas of the region which has been taken from the area of LOV.

    Is this possible without having to submit the page?

    I'd appreciate any help.

    Concerning

    Dominic

    Maguzzi wrote:

    Apex Version: 4.2

    I struggled to get a LOV to be based on the selected value of an another LOV on the same page without submitting the page.

    For example. I have two LOV ' page.

    The first is a LOV region and the second is a LOV box.

    I want the list returned by the LOV area to include only the areas of the region which has been taken from the area of LOV.

    Is this possible without having to submit the page?

    Integrated support in cascade LOV is addressed in the documentation.

  • Display list items based on another element of the list

    Hi all

    I want to display the list item based on another element of the list, but his does not work.

    This is my code:


    / * WHEN-NEW-FORM-INSTANCE * /-his work.
    DECLARE

    rg_district recordgroup;

    rg_name VARCHAR2 (40): = "district";

    vtemp NUMBER;

    BEGIN

    rg_district: = FIND_GROUP (rg_name);

    IF ID_NULL (rg_district)

    THEN

    rg_district: =.

    CREATE_GROUP_FROM_QUERY (rg_name,

    'select dist, dist district_mas.

    );

    vtemp: = POPULATE_GROUP (rg_district);

    POPULATE_LIST ('BLOCK3.) Of RIDING ", rg_name);

    END IF;

    END;

    * / CHANGED AFTER a - list * /-does not work. Cannot complete the list based on the list

    DECLARE

    rg_branch recordgroup;

    rg_name1 VARCHAR2 (1000): = "branch";

    vtemp NUMBER;

    BEGIN

    rg_branch: = FIND_GROUP (rg_name1);

    IF this is ID_NULL (rg_branch)

    THEN

    DELETE_GROUP (rg_name1);

    rg_branch: =.

    CREATE_GROUP_FROM_QUERY

    ("rg_branch",

    "SELECT FROM dist_branch WHERE district IN branch (DIST DISTRICT_MAS WHERE DISTRICT = SELECT').

    || : BLOCK3. DISTRICT OF

    );

    vtemp: = POPULATE_GROUP (rg_branch);

    POPULATE_LIST ('BLOCK3.) Branch of THE ', rg_branch);

    END IF;

    END;

    Table:

    CREATE TABLE DISTRICT_MAS

    (

    DIST VARCHAR2 (100 CHAR)

    );

    CREATE TABLE DIST_BRANCH

    (

    NEIGHBORHOOD VARCHAR2 (100 CHAR),

    DIRECTORATE GENERAL OF THE VARCHAR2 (100 CHAR)

    );

    Values:

    insert into district_mas values ('chennai');

    insert into district_mas values ('coimbatore');

    insert into dist_branch values ('chennai', 'chennai_north');

    insert into dist_branch values ('coimbatore', 'Podanur');


    Concerning

    Nassik M

    I tested the code below when the list has changed


    DECLARE

    rg_branch recordgroup;

    rg_name1 VARCHAR2 (1000): = "branch";

    vtemp NUMBER;

    QT VARCHAR2 (10): = "';

    BEGIN

    rg_branch: = FIND_GROUP (rg_name1);

    IF this is ID_NULL (rg_branch)

    THEN

    DELETE_GROUP (rg_name1);

    END IF;

    rg_branch: =.

    CREATE_GROUP_FROM_QUERY

    (rg_name1,

    'SELECT branch, branch OF THE DISTRICT WHERE the dist_branch =' | QT | : BLOCK3. DISTRICT OF | QT);

    vtemp: = POPULATE_GROUP (rg_branch);

    POPULATE_LIST ('BLOCK3.) Branch of THE ', rg_branch);

    END;

    Hope it's work...

    Hamid

  • How do column filter based on another column

    In my report, I have column a thru d. I would like to create a filter based on another column where column is column B. I can enter a value that the column cannot be equal to, but I would use a column instead of a value.

    Thank you.
    Jonathan

    Try this: icon on the filter columns->-> convert this advanced filter for SQL
    You can reference any other column

    BTW: Have you had a chance to look at my suggestion for your post
    Tables from a Table

  • Choose field from the joined table based on another field?

    Hello!

    Is it possible to select a field in a row of attached table based on another field? Consider the following data in the CVALUES table:
    ID  C1   C2    C3    C4    C5    C6
    T1  9.6  10.3  12.4  19.6  19.6    0
    T7  9.6  10.4     0     0     0    0
    T3  8.2   9.9  11.4  19.6  19.6    0
    T8  8.3  10.7  13.5  20.7     0    0
    T5  9.4  10.3  12.7  22.9  19.6    0
    ...
    And the following data in the table MDETAIL:
    ID           MDATE        CNUM     ...
    T1  03/28/2012 18:00:00    4
    T1  03/28/2012 18:00:00    1
    T8  03/29/2012 06:00:00    6
    T8  03/29/2012 06:00:00    5
    ...
    I want to get the column corresponding to the VALUE field in the table MDETAIL CVALUES. I'm doing this:
    SELECT m.t1, m.mdate,
           CASE WHEN m.cnum = 1 THEN c.c1
                WHEN m.cnum = 2 THEN c.c2
                WHEN m.cnum = 3 THEN c.c3
                WHEN m.cnum = 4 THEN c.c4
                WHEN m.cnum = 5 THEN c.c5
                WHEN m.cnum = 6 THEN c.c6 END AS cvalue
      FROM mdetail m
      JOIN cvalues c ON m.id = c.id
    The CVALUES table records are unique; only one line by ID.

    This method works and it's fast, but it's messy code and I think there must be a better way to do it. I use cvalue value in several calculations so each calculation that I use is this giant glob of CASES inside!

    Hello

    With a decoding it would be easier, but as ugly :-)

    SELECT m.t1, m.mdate,
           DECODE( m.cnum , 1 , c.c1, 2, c.c2, 3, c.c3, 4, c.c4, 5, c,c5, 6, c,c6) cvalue
      FROM mdetail m, cvalues c
      WHERE m.id = c.id
    

    Success!

    FJFranken

  • Delete based on another column dublicate records

    How can I remove duplicate records, based on another column.

    the table structure
    CREATE TABLE IA_EXPORT_LEVEL
    (
    A_NO VARCHAR2 (22 BYTE),
    IM VARCHAR2 (18 BYTE),
    ctn_level NUMBER (2)
    )

    reviews
    A_NO IM ctn_level

    S1 S1 1
    S1 M1 2
    S1 h1 3
    H2 S2 1
    S2 h2 2
    S3 h1 2
    S3 h1 3
    S4 h6 4
    S4 h6 5

    I want to delete all records other than the minimum value of the ctn_level

    output should like below
    S1 S1 1
    H2 S2 1
    S3 h1 2
    S4 h6 4

    Published by: OraFighter on December 16, 2011 13:44
    DELETE FROM IA_EXPORT_LEVEL where rowid IN
    (select rid from
    (select rowid rid, row_number() over (partition by A_NO,IM order by ctn_level) rn from IA_EXPORT_LEVEL )
    where rn > 1 )
    /
    

    Hope your question.

  • BC4J editable attribute based on another attribute

    Hello.

    Is it possible to define updatable (read-only) on BC4J, based on another column. For example if attribute a == true which attribute the (Always) b.setUpdatable of other b.setUpdatable (Never). By definition, changing Updatable property to EO/VO for each line is an absurdity. Or not?
    I know how to do it on ViewController (set ReadOnly property expression EL provided you attribute a different value) but don't know how to do (if it is possible) on model?

    THX

    Concerning
    Zmeda

    zmeda,

    You can override isAttributeUpdatable() on your EntityImpl or ViewRowImpl classes

    John

  • Make a mandatory DFF field based on another field

    Hi all

    We have a requirement where we need to do a mandatory DFF field based on another field.

    example:

    FDF has two fields:

    Depose1: the values 'Email', 'Fax '.
    Depose2

    If "Email" is selected in 'Field1' Field2 should become mandatory.

    All entries on this will be really useful.

    Thank you and best regards,
    Satya.

    Please see old topics that cover the same subject - http://forums.oracle.com/forums/search.jspa?threadID=&q=DFF+AND+mandatory+ANd+Dependant&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001

    Thank you
    Hussein

  • How to get the print page numbers in a report based on another report

    Hello


    I have a requirement in which I need to print the page based on another report number
    example my game application has 3 reports

    1 report prints the pages 1-100
    Report page no. 2 should start from 101 to 110
    3 report 111-

    Can someone make me please how to do this?

    THX in advance
    Kumar

    Hello

    You can create all report queries three in a single report, create a separate query in the data model and then create the layout in the proper sequence as required.

    If you want to use separate reports only you can try the following:

    In the first report, use the shutter release after report and record the total number of pages of a table as a record.

    In the second report, extract the value stored in the table and add it to the Page No. to get the Page number for the second report.
    Also in the second report use the shutter release after report and update the record created first in the total number of pages + total number of pages of the first report.

    In the third report to extract the value stored in the table and add it to the Page No. to get the Page number for the third report.
    Don't forget to delete the folder created in the trigger after the third report table report.

    I hope this helps.

    Best regards

    Arif Khadas

  • VI to convert input signals NI 9402 in a RPM value, based on the frequency of the pulses

    Hello

    I'm looking for a VI convert an input signal NI 9402 in a RPM value, based on the frequency of the pulses. Is there such a thing that exists in the library of national instruments?

    I run LAbview 2014 integrated control and monitoring on on a cRIO 9802 high performance integrated system with NEITHER 9402, 4 channels, 50 LV, LV TTL Module input/output digital, ultra high speed digital i/o for the cRIO module.

    Any help would be greatly appreciated.

    The easiest way is to use the FPGA to get the time between the edges of your pulse increase (shift registers to maintain the current situation and the time will be necessary).  This will give you the period.  If it's a single pulse per turn, then the number of laps is just 60/T, where T is the time in seconds.

Maybe you are looking for