Procedure to compare 2 Tupels

Hi,
I´m new in the Procedure-Topic and need some help.
At the moment there is a Scheduled Job running. This DB-Job does a Insert from Table A to Table B every two hours.
The problem is, that only records from Table A should be inserted to Table B if this record/s is/are not inserted in Table A, yet.
If the Record isn´t in Table B, it need to be inserted there.
If the Record is in Table B yet, it must not be inserted in Table B.
Thank you for your help
Best Regards
Steve

Hi,
That sounds like a job for MERGE, rather than INSERT. If you're using Oracle 10 (or higher), then simply omit the WHEN MATCHED clause.
You could also put a unique constraint on the table. If you try to insert a row that's already in the table; the statement will fail. (If you're only adding 1 row at a time, then the only INSERTs you lose will be the ones you want to lose.)
Personally, I would do both: use MERGE to only add rows when they really are new, and use a unique constraint to raise an error (and block the bad data) if the MERGE doesn't work correctly.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
If you're asking about a DML statement, such as INSERT, the sample data will be the contents of the table(s) before the DML, and the results will be state of the changed table(s) when everything is finished.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
Edited by: Frank Kulash on Feb 6, 2012 8:53 AM

Similar Messages

  • Stored Procedure to compare two tables data

    Hello,
    I want to have a Stored Procedure which will compare data (only a single column) of two tables and delete the row which is not present in the second table.
    For eg.,
    I have got 2 tables called Table1 and Table2, which have the same column called ID(PK).
    The data in Table1 is 1,2,3 and data in Table2 is 1,3. When the stored procedure runs, it has to compare the ID column in Table1 to ID column in Table2 and since '2' is not there in Table2, I want to delete this row from Table1.
    Thanks in advance.

    user11281601 wrote:
    Hello,
    I want to have a Stored Procedure which will compare data (only a single column) of two tables and delete the row which is not present in the second table.
    For eg.,
    I have got 2 tables called Table1 and Table2, which have the same column called ID(PK).
    The data in Table1 is 1,2,3 and data in Table2 is 1,3. When the stored procedure runs, it has to compare the ID column in Table1 to ID column in Table2 and since '2' is not there in Table2, I want to delete this row from Table1.
    Thanks in advance.
    delete from table1 where id_column in
    (select id_column from table1
    minus
    select id_column from table2);

  • SATATIS of Procedural ABAP compared with CLASS-DATA of OO ABAP.

    Hi,
    Is the STATICS statement in procedural ABAP synonymous to CLASS-DATA in OO ABAP.
    Please help.
    Regards,
    Rajesh.

    Hello Rajesh
    The strict answer is: no, they are different. However, they share things in common.
    That's what the SAP documentation says about STATICS:
    <a href="http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db982c35c111d1829f0000e829fbfe/content.htm">Local Data in the Subroutine</a>
    <b>Static Local Data Objects</b>
    <i>If you want to keep the value of a local data object after exiting the subroutine, you must use the STATICS statement to declare it instead of the DATA statement. With STATICS you declare a data object that is globally defined, but only locally visible from the subroutine in which it is defined.</i>
    Class-data are also globally defined yet they are valid everywhere within your class. That is different from local static variables that are only visible within the FORM routine where they are declared.
    Regards
      Uwe

  • Error executing a stored procedure from SSIS using the MERGE statement between databases

    Good morning,
    I'm trying to execute from SSIS a stored procedure that compares the content of two tables on different databases in the same server and updates one of them. To perform this action, I've created a stored procedure in the destination database and I'm
    comparing the data between tables with the MERGE statement. When I execute the procedure on the destination database the error that I obtain is:
    "Msg 916, Level 14, State 1, Procedure RefreshDestinationTable, Line 13
    The server principal "XXXX" is not able to access the database "XXXX" under the current security context."
    Some things to take in account:
    1. I've created a temporary table on the same destination database to check if the problem was on the MERGE statement and it works fine.
    2. I've created the procedure with the option "WITH EXECUTE AS DBO".
    I've read that it can be a problem of permissions but I don't know if I'm executing the procedure from SSIS to which user/login I should give permissions and which.
    Could you give me some tip to continue investigating how to solve the problem?
    Thank you,
    Virgilio

    Read Erland's article http://www.sommarskog.se/grantperm.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to compare string in a table reg

    Hi all,
    I need a solution of this requirement.
    i have Table reqtab
    Code sql:
    sql>select * FROM reqtab;
    REID EMAILADDRESS
    72 [email][email protected][email]
    72 [email][email protected][email]
    75 [email][email protected][email]
    75 [email][email protected][email]
    now the requirement is:
    ---> i have to create a procedure which should takes 72, 75 as in parameter
    and these procedure should compare emailaddress of 72, 75 and if this emailaddresses are not matching ,should update with unique mailids
    for 72
    i need the table should be updated in the following way
    result should be
    Code sql:
    REID EMAILADDRESS
    72 [email][email protected][email]
    72 [email][email protected][email]
    72 [email][email protected][email]
    Thanks n Regards
    Laxman

    LAX_ORA wrote:
    Hi all,
    I need a solution of this requirement.
    i have Table reqtab
    Code sql:
    sql>select * FROM reqtab;
    REID EMAILADDRESS
    72 [email][email protected][email]
    72 [email][email protected][email]
    75 [email][email protected][email]
    75 [email][email protected][email]
    now the requirement is:
    ---> i have to create a procedure which should takes 72, 75 as in parameter
    and these procedure should compare emailaddress of 72, 75 and if this emailaddresses are not matching ,should update with unique mailids
    for 72
    i need the table should be updated in the following way
    result should be
    Code sql:
    REID EMAILADDRESS
    72 [email][email protected][email]
    72 [email][email protected][email]
    72 [email][email protected][email]
    Thanks n Regards
    LaxmanYou're talking of a combination of updates and deletes to your table.
    You can define a query that can determine what action needs to be taken for each record e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 72 as reid, '[email][email protected][/email]' as emailaddress from dual union all
      2             select 72, '[email][email protected][/email]' from dual union all
      3             select 75, '[email][email protected][/email]' from dual union all
      4             select 75, '[email][email protected][/email]' from dual)
      5  --
      6  -- END OF TEST DATA
      7  --
      8      ,req as (select 72 as reid from dual union all
      9               select 75 from dual)
    10      ,mreq as (select min(reid) as reid from req)
    11  --
    12  select t.reid, t.emailaddress, case when mreq.reid = t.reid then 'No Action'
    13                                      when mreq.reid < t.reid and row_number() over (partition by t.emailaddress order by t.reid) =1 then 'Update to '||mreq.reid
    14                                 else 'Delete'
    15                                 end as action
    16  from   t       join req on (t.reid = req.reid)
    17           cross join mreq
    18* order by 2
    SQL> /
          REID EMAILADDRESS              ACTION
            72 [email][email protected][/email]  No Action
            75 [email][email protected][/email]  Delete
            72 [email][email protected][/email] No Action
            75 [email][email protected][/email]  Update to 72
    SQL>... and then action each of those as required.
    Doing it in this way, having your required REID values in a table (temporary table or whatever) will allow the query to work for any number of such values e.g. here's an example with 3 of them...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 72 as reid, '[email][email protected][/email]' as emailaddress from dual union all
      2             select 72, '[email][email protected][/email]' from dual union all
      3             select 75, '[email][email protected][/email]' from dual union all
      4             select 75, '[email][email protected][/email]' from dual union all
      5             select 77, '[email][email protected][/email]' from dual union all
      6             select 77, '[email][email protected][/email]' from dual)
      7  --
      8  -- END OF TEST DATA
      9  --
    10      ,req as (select 72 as reid from dual union all
    11               select 75 from dual union all
    12               select 77 from dual)
    13      ,mreq as (select min(reid) as reid from req)
    14  --
    15  select t.reid, t.emailaddress, case when mreq.reid = t.reid then 'No Action'
    16                                      when mreq.reid < t.reid and row_number() over (partition by t.emailaddress order by t.reid) =1 then 'Update to '||mreq.reid
    17                                 else 'Delete'
    18                                 end as action
    19  from   t       join req on (t.reid = req.reid)
    20           cross join mreq
    21* order by 2
    SQL> /
          REID EMAILADDRESS              ACTION
            72 [email][email protected][/email]  No Action
            75 [email][email protected][/email]  Delete
            77 [email][email protected][/email]  Delete
            72 [email][email protected][/email] No Action
            75 [email][email protected][/email]  Update to 72
            77 [email][email protected][/email]  Update to 72
    6 rows selected.
    SQL>

  • API/package/procedure/function for updating physical attributes in Org/Mast

    I need some kind of procedure or function for updating the weight, volume, and dimensions in the organization and master items forms. We have almost 350,000 items and I want to update them in batch. Is there an API of some kind for this? I would do a simple update but I want to make sure there's no additional logic necessary (other tables that are updated during the process of updating those fields, etc).
    Thanks!

    here is for API's you need to check...
    You can use Decimal & UOM Quantity API
    These APIs are used to handle item decimal quantities:
    Convert from one UOM to another
    Validate quantities at input time
    Validate quantities at display/output time
    Quantity Comparison
    Get UOM information
    For your convenience, I am giving you the API as below:
    /*===========================================================================+
    | Copyright (c) 1999 Oracle Corporation |
    | Redwood Shores, California, USA |
    | All rights reserved. |
    +===========================================================================*/
    /*-----------------------------------------------------------------------+
    |This package contains procedures relevent to item decimal quantity |
    |processing. This package contains routines to: |
    |(1)validate item quantities based on UOM and decimal precision rules |
    |(2)validate whether the UOM controls and decimal precision rules |
    | themselves are correct based on functionality planned. For reviewing|
    | UOM and decimal quantity functional design details, please visit the|
    | following URL: |
    | "http//apps-us.oracle.com/inv/development/designs_120/ |
    | decimal_precision/decimal_precision.html" |
    |But here are a few basics to give background context: |
    | |
    | "Item Quantity" -- The item's quantity is described by the item |
    | identifier, the unit of measure (e.g. grams, kilos, etc), and a |
    | number value to indicate the amount in that unit of measure. |
    | |
    | "Unit of Measure" -- Units of measure belong to unit of measure |
    | classes(e.g. weight, volume, length, etc). Each unit of measure class|
    | has actual units of measure that belong to that class (e.g. the |
    | weight class may have units of measures like, "grams", "kilos", etc).|
    | |
    | "UOM Conversion" --Users can set up conversion rates between UOMs in |
    | them same UOM class, by defining conversions to the base UOM. These |
    | are standard conversions. Item-level intra-class conversions may also|
    | be defined. When doing intra-class conversions, item-level |
    | intra-class conversions are used first if defined, and then standard |
    | conversions are used. |
    | Users can define inter-class conversions. Inter-class Conversions may|
    | also be defined at the lot/sublot levels. For inter-class conversions|
    | sublot, lot, and then item inter-class conversions will be used in |
    | in order. If lot-lvel conversion is not defined, then item-level |
    | conversion is used. A strict hierarchy is imposed. |
    | |
    | "TU" -- Trasactable Unit.A UOM may have a TU. This implies |
    | that when transacting in this UOM, any item's quantities will be |
    | forced to be integer multiples of this TU quantity. The TU may also |
    | be declared at the item level. The TU quantity at the item level may |
    | be different from the UOM level TU, and if defined, item level TU |
    | takes precedance. |
    | |
    | "Decimal Precision"--Users have a choice of setting decimal precision|
    | at the base UOM for each UOM class. All other UOMs in that class get |
    | get their decimal precisions derived from the base UOM decimal |
    | precision, the converison rate, and TUs, if they are |
    | being used. |
    | |
    | |
    | "Conversion Rate Tolerance" -- This is a tolerance that may be set |
    | when conversion rate cannot be not strictly fixed. Example: |
    | 1 Chicken = 2 pounds (plus or minus 0.7 pounds). This 0.7 pounds is |
    | the conversion rate tolerance. Conversion rate tolerance is only |
    | definable at inter-class UOM conversions, at item or lot/sublot level|
    | |
    | History |
    | 04/08/99 Mansoor Jafri Created Package Spec |
    | 04/26/99 Mansoor Jafri Updated with TU at 3 levels as |
    | opposed to MTU at 2 and atomic at|
    | UOM class level. |
    | 04/29/99 Mansoor Jafri Updated document with lot/sublot |
    | conversions. Also, removed |
    | "atomic" as a separate control, |
    | since this can |
    | implemented as a TU at base UOM |
    | level with an integer quantity. |
    | 05/03/99 Mansoor Jafri Updated the package with sublot |
    | level control. Also, changed name|
    | of DTU to TU, so that it fits |
    | better in the "process" market. |
    | Also, conformed to BOI API stds. |
    +-----------------------------------------------------------------------*/
    SET VERIFY OFF
    WHENEVER SQLERROR EXIT FAILURE ROLLBACK;
    CREATE OR REPLACE PACKAGE inv_decimals_pub AS
    /* $Header: INVDECPS.pls 118.3 99/05/03 18:12:27 mjafri noship $ */
    /*--------------------------------------------------------------------------+
    |Procedure validate_compare_quantities(..)
    |Returns the quantity converted from the first UOM in the second UOM.
    |If quantities in 2 UOMs are already available, then this procedure will
    |compare and validate these quantities based on conversion rates
    |and UOM and decimal qty controls. This procedure may be used to validate
    |scenarios where quatities are entered in dual UOMs. We want to make sure
    |quantities are valid based on conversion, TUs, and conversion
    |rate tolerances.
    |
    |Procedure validate_and_compare(
    |p_api_version_number IN NUMBER, -- version # of API
    |p_init_msg_list IN VARCHAR2, -- whether to initialize list
    |p_inventory_item_id IN NUMBER, -- inventory_item_id
    |p_organization_id IN NUMBER, -- organization_id
    |p_lot_control_code IN NUMBER, -- item's lot control code
    |p_lot_number IN VARCHAR2, -- lot number
    |p_sub_lot_control_code IN NUMBER, --sub lot control code
    |p_sublot_number IN VARCHAR2, -- sublot number
    |p_from_quantity IN NUMBER, -- qty in first UOM
    |p_from_uom_code IN VARCHAR2, -- UOM of fisrt qty
    |p_to_uom_code IN VARCHAR2, -- UOM of second qty
    |p_to_quantity_to_check IN NUMBER, -- qty in second UOM
    |x_resultant_to_quantity OUT NUMBER, -- calculated qty in second UOM
    |x_comparison OUT NUMBER,--Possible values are 1,0,-1,-99
    |x_msg_count OUT NUMBER, -- number of messages
    |x_msg_data OUT VARCHAR2, -- populated,if msg count = 1
    |x_return_status OUT VARCHAR2) -- return status
    |
    |Note: The comparisons are done in base UOM
    | of the UOM class to which the first UOM belongs. x_comparison returns:
    |-1 if from_quantity is less than to_quantity (A < B)
    | 0 if from_quantity is equal to to_quantity (A = B)
    | 1 if from_quantity is greater than to_quantity (A > B)
    | -99 if the validations for the first/second quantity failed
    | If the UOMs belong to different classes, then users can specify whether
    | they want to use the effective interclass UOM conversion tolerance, say, T.
    | CASE: p_use_interclass_tolerance = 1
    | ------
    | Q1 > Q2 if (Q1 - Q2) >= T
    | Q1 = Q2 if ABS(Q1 - Q2) < T
    | Q1 < Q2 if (Q1 - Q2 ) <= -T
    |
    |The output variable x_resultant_to_quantity will contain the converted
    |quantity
    |in the second UOM, using effective conversion rates.
    |Usage: In a dual UOM scenario, this api will confirm whether quantities in
    |the two UOMs are equal or not, based on x_comparison output variable.
    +--------------------------------------------------------------------------*/
    Procedure validate_compare_quantities(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCHAR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    p_from_quantity IN NUMBER,
    p_from_uom_code IN VARCHAR2,
    p_to_uom_code IN VARCHAR2,
    p_to_quantity_to_check IN NUMBER,
    x_resultant_to_quantity OUT NUMBER,
    x_valid_conversion OUT NUMBER,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2);
    /*--------------------------------------------------------------------------+
    |Function convert_UOM(..) return NUMBER ;
    |Returns the quantity converted from the first unit into the second unit.
    |If conversion is not possible, return status is failure.
    |Function convert(
    |p_api_version_number IN NUMBER,
    |p_init_msg_list IN VARCHAR2, -- whether to initialize list
    |p_inventory_item_id IN NUMBER, -- inventory_item_id
    |p_organization_id IN NUMBER, -- organization_id
    |p_lot_control_code IN NUMBER, -- item's lot control code
    |p_lot_number IN VARCHAR2, -- lot number
    |p_sub_lot_control_code IN NUMBER,
    |p_sublot_number IN VARCHAR2,
    |p_from_quantity IN NUMBER, -- qty in first UOM
    |p_from_uom_code IN VARCHAR2, -- UOM of fisrt qty
    |p_to_uom_code IN VARCHAR2, -- UOM of second qty
    |x_msg_count OUT NUMBER,
    |x_msg_data OUT VARCHAR2,
    |x_return_status OUT VARCHAR2)
    | return NUMBER ;
    |If there is an error, then -99 is returned.
    |1) From_quantity must be an absolute value.
    |2) From_quantity will be truncated to decimal precision in the from UOM, then
    | converted to base UOM in the class,
    |3) Then converted to base UOM of the
    | to_UOM class,
    |4) Then converted to the quantity in to_UOM,
    |5) Then truncated to decimal precision of the to_UOM.
    +--------------------------------------------------------------------------*/
    Function convert_UOM(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCHAR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    p_from_quantity IN NUMBER,
    p_from_uom_code IN VARCHAR2,
    p_to_uom_code IN VARCHAR2,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2) return NUMBER ;
    /*--------------------------------------------------------------------------+
    | get_uom_properties(..)
    | This procedure is used to interrogate the UOM.
    | It returns:
    | (1) decimal precision at the UOM level
    | (2) TU, if defined, at the UOM level
    | (3) Atomicity, if defined for the class that this UOM belongs to
    | If some of the controls are not defined, null values are returned.
    | if the UOM is not found, the return status indicates this.
    | Procedure get_uom_properties(
    | p_api_version_number IN NUMBER,
    | p_init_msg_list IN VARCHAR2,
    | p_uom_code IN VARCHAR2,
    | x_decimal_precision OUT NUMBER,
    | x_uom_TU OUT NUMBER,
    | x_uom_class OUT VARCHAR2,
    | x_msg_count OUT NUMBER,
    | x_msg_data OUT VARCHAR2,
    | x_return_status OUT VARCAHR2);
    +--------------------------------------------------------------------------*/
    Procedure get_uom_properties(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_uom_code IN VARCHAR2,
    x_decimal_precision OUT NUMBER,
    x_uom_TU OUT NUMBER,
    x_uom_class OUT VARCHAR2,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCAHR2);
    /*-------------------------------------------------------------------------+
    | get_item_uom_properties(..)
    | This procedure returns a specific item's primary UOM, TU, and tolerance
    | Procedure get_item_uom_properties(
    | p_api_version_number IN NUMBER,
    | p_init_msg_list IN VARCHAR2,
    | p_inventory_item_id IN NUMBER,
    | p_organization_id IN NUMBER,
    | p_lot_control_code IN NUMBER, -- item's lot control code
    | p_lot_number IN VARCHAR2,
    | p_sub_lot_control_code IN NUMBER,
    | p_sublot_number IN VARCHAR2,
    | x_primary_uom_code OUT VARCHAR2,
    | x_uom_class OUT VARCHAR2,
    | x_decimal_precision OUT NUMBER,
    | x_item_TU OUT NUMBER,
    | x_uom_TU OUT NUMBER,
    | x_effective_TU OUT NUMBER,
    | x_msg_count OUT NUMBER,
    | x_msg_data OUT VARCHAR2,
    | x_return_status OUT VARCHAR2 );
    | If the item is not a valid one, then this is reflected through the
    | return status.
    +-------------------------------------------------------------------------*/
    Procedure get_item_uom_properties(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCHAR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    x_primary_uom_code OUT VARCHAR2,
    x_uom_class OUT VARCHAR2,
    x_decimal_precision OUT NUMBER,
    x_item_TU OUT NUMBER,
    x_class_TU OUT NUMBER,
    x_uom_TU OUT NUMBER,
    x_effective_TU OUT NUMBER,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2 );
    /*-------------------------------------------------------------------------+
    | Procedure compare_quantities(..)
    | Procedure compare_quantities(
    | p_api_version_number IN NUMBER,
    | p_init_msg_list IN VARCHAR2,
    | p_inventory_item_id IN NUMBER,
    | p_organization_id IN NUMBER,
    | p_lot_control_code IN NUMBER,
    | p_lot_number IN VARCHAR2,
    | p_sub_lot_control_code IN NUMBER,
    | p_sublot_number IN VARCHAR2,
    | p_fisrt_qauantity IN NUMBER,
    | p_first_uom IN VARCHAR2,
    | p_second_quantity IN NUMBER,
    | p_second_uom IN VARCHAR2,
    | p_use_interclass_tolerance IN VARCHAR2, -- Yes = 1, 2 = No
    | x_comaprison_result OUT NUMBER,
    | x_msg_count OUT NUMBER,
    | x_msg_data OUT VARCHAR2,
    | x_return_status OUT VARCHAR2);
    |
    | This procedure compares the quantities A and B and returns result in the
    | output variable x_comparison_result. The comparisons are done in base UOM
    | of the UOM class to which the first UOM belongs:
    |-1 if quantity A is less than quantity B (A < B)
    | 0 if quantity A is equal to quantity B (A = B)
    | 1 if quantity A is greater than quantity B (A > B)
    | If the UOMs belong to different classes, then users can specify whether
    | they want to use interclass UOM conversion tolerance, say, T.
    | CASE: p_use_interclass_tolerance = 1
    | ------
    | Q1 > Q2 if (Q1 - Q2) >= T
    | Q1 = Q2 if ABS(Q1 - Q2) < T
    | Q1 < Q2 if (Q1 - Q2 ) <= -T
    +------------------------------------------------------------------------*/
    Procedure compare_quantities(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCAHR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    p_fisrt_qauantity IN NUMBER,
    p_first_uom IN VARCHAR2,
    p_second_quantity IN NUMBER,
    p_second_uom IN VARCHAR2,
    p_use_interclass_tolerance IN VARCHAR2,
    x_comaprison_result OUT NUMBER,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2);
    /*-----------------------------------------------------------------------+
    | Procedure Validate_Quantity(
    | p_api_version_number IN NUMBER,
    | p_init_msg_list IN VARCHAR2,
    | p_inventory_item_id IN NUMBER,
    | p_organization_id IN NUMBER,
    | p_lot_control_code IN NUMBER,
    | p_lot_number IN VARCHAR2,
    | p_sub_lot_control_code IN NUMBER,
    | p_sublot_number IN VARCHAR2,
    | p_input_quantity IN NUMBER,
    | p_UOM_code IN VARCHAR2,
    | x_msg_count OUT NUMBER,
    | x_msg_data OUT VARCHAR2,
    | x_return_status OUT VARCHAR2);
    |
    | Validates and returns the quantity in this manner (the caller does not need
    | to adjust the result):
    | 0. Truncate to and validate decimal precision
    | 1. Validate quantity with respect to TU controls.
    +-------------------------------------------------------------------------*/
    Procedure Validate_Quantity(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCAHR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    p_input_quantity IN NUMBER,
    p_UOM_code IN VARCHAR2,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2);
    /*------------------------------------------------------------------------+
    | Function Truncate_Quantity(
    | p_api_version_number IN NUMBER,
    | p_init_msg_list IN VARCHAR2,
    | p_inventory_item_id IN NUMBER,
    | p_organization_id IN NUMBER,
    | p_lot_control_code IN NUMBER,
    | p_lot_number IN VARCHAR2,
    | p_sub_lot_control_code IN NUMBER,
    | p_sublot_number IN VARCHAR2,
    | p_input_quantity IN NUMBER,
    | p_UOM_code IN VARCHAR2,
    | x_msg_count OUT NUMBER,
    | x_msg_data OUT VARCHAR2,
    | x_return_status OUT VARCHAR2) return NUMBER;
    |
    | Truncates the quantity to decimal precision of the UOM.
    | In case of error conditions, -99 is returned.
    +------------------------------------------------------------------------*/
    Function Truncate_Quantity(
    p_api_version_number IN NUMBER,
    p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
    p_inventory_item_id IN NUMBER,
    p_organization_id IN NUMBER,
    p_lot_control_code IN NUMBER,
    p_lot_number IN VARCHAR2,
    p_sub_lot_control_code IN NUMBER,
    p_sublot_number IN VARCHAR2,
    p_input_quantity IN NUMBER,
    p_UOM_code IN VARCHAR2,
    x_msg_count OUT NUMBER,
    x_msg_data OUT VARCHAR2,
    x_return_status OUT VARCHAR2) return NUMBER;
    * show errors package INV_DECIMALS_PUB
    * SELECT to_date('SQLERROR') FROM user_errors
    * WHERE name = 'INV_DECIMALS_PUB'
    * AND type = 'PACKAGE';
    commit;
    exit;

  • Schema Compare SqlDatabaseOptions Timeout

    Have a small Azure SQL DB (handful of tables and stored procs) that I been able to successfully import into Visual Studio 2013 as a DB project, and all the objects (tables and procs) do get imported properly. But when trying to do a comparison
    using Schema Compare tool between my project and the Azure SQL, I keep receiving an error message:
    "An error was received from SQL Server while attempting to reverse engineer elements of type Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlDatabaseOptions: Timeout expired."
    I have set my DB project property for target DB to Azure SQL Database, but it does nothing to solve the problem. I have also set that only tables and stored procedures are compared.
    I am not sure what am I missing here. Will note that I am using the new DB tier on Azure, but I don't think that makes a difference. My best guess it that my permissions are not set right, but it puzzles me that I was able to import the Azure SQL DB into
    the project initially without a problem, where a schema model had to be looked up.

    Hi Hrovje Maric,
    In theory, the new Schema Compare and Data Compare features in Visual Studio 2013 supports SQL Server and Windows Azure databases. Usually, when you want to compare your working database project with the database, you can use the schema compare by right
    clicking on your database project and selecting Schema Compare. However, according to your description, the timeout error occurs when you using schema compare. We need to check if your login have permission to view definition. Or if the database which be used
    for schema compare was restored from backups of other place, the users in the databases may lose their SID, you need to delete the database users and recreate them and then restart the schema comparison again.
    In addition, you can try to increase the query timeout allowed on the connection. In the Windows Registry, search the key "QueryTimeoutSeconds" and increase the value from 60 to 360 and try to use the schema compare and check if the timeouts error will disappear
    Visual Studio 2013.
    For more information, there is detail about Schema Compare for SQL Server in Visual Studio 2013, 
    you can review the following article.
    http://www.techbubbles.com/sql-server/schema-compare-for-sql-server-in-visual-studio-2013/
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Compare BI publisher set-up between various environments

    Hi All,
    DB:10.2.0.4.0
    Oracle Apps:12.0.6
    BI Publisher version:10.1.3.0
    Is there a way to Compare BI publisher set-up between various environments.
    It looks like that reports are behaving differently in different environments.
    Could anyone please share the steps/procedure to compare.
    Thanks for your time!
    Regards,

    One option might be to use Diagnostics to print out settings from each instance, then compare them.
    Pl see MOS Doc 388165.1 (11i : Oracle Application Object Library XML Publisher Data Collection Test) for details - this is for 11i but should be applicable for R12 also.
    HTH
    Srini

  • Procedure to check data from different tables

    Hi
    I am trying to write a procedure to compare data from a table with another.
    Table 1
    ID Name Dept
    1 ABC Y
    2 DEF Z
    Table 2
    ID Dept
    1 Y
    2 Z
    Table 3
    Name ID
    1 ABC
    2 DEF
    I would like to compare each record data in Table 1 with data from different tables table2,table3 by matching ID,name.... Please help me with how I could start writing a procedure and also spool data that does not match from the table1 with other tables
    thanks
    Edited by: 890563 on Apr 30, 2012 10:34 AM

    Hope below helps you.
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE1 VALUES('123456','testfirst','testlast','testmiddle');
    INSERT INTO TABLE1 VALUES('123457','testfirst1','testlast1','testmiddle1');
    CREATE TABLE TABLE1
    (    ID          VARCHAR2(10),
         FIRST_NAME  VARCHAR2(30),
         LAST_NAME   VARCHAR2(30),
         MIDDLE_NAME VARCHAR2(30)
    INSERT INTO TABLE2 VALUES('123456','testfirst','testlas','testmidd');
    INSERT INTO TABLE2 VALUES('123457','testfirst2','testlast1','testmiddle1');
    SELECT TABLE1.ID,
            -- Match First Name
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE1.FIRST_NAME ELSE NULL END TABLE1_FIRST_NAME,
         CASE WHEN TABLE1.FIRST_NAME != TABLE2.FIRST_NAME THEN TABLE2.FIRST_NAME ELSE NULL END TABLE2_FIRST_NAME,
            -- Match Middle Name
         CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE1.MIDDLE_NAME ELSE NULL END TABLE1_MIDDLE_NAME,
            CASE WHEN TABLE1.MIDDLE_NAME != TABLE2.MIDDLE_NAME THEN TABLE2.MIDDLE_NAME ELSE NULL END TABLE2_MIDDLE_NAME,
            -- Match Last Name
         CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE1.LAST_NAME ELSE NULL END TABLE1_LAST_NAME,
            CASE WHEN TABLE1.LAST_NAME != TABLE2.LAST_NAME THEN TABLE2.LAST_NAME ELSE NULL END TABLE2_LAST_NAME
    FROM  TABLE1, TABLE2
    WHERE TABLE1.ID = TABLE2.ID
    ID         TABLE1_FIRST_NAME  TABLE2_FIRST_NAME  TABLE1_MIDDLE_NAME TABLE2_MIDDLE_NAME TABLE1_LAST_NAME   TABLE2_LAST_NAME
    123456     NULL               NULL               testmiddle         testmidd           testlast        testlas
    123457     testfirst1         testfirst2         NULL               NULL               NULL            NULL
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • URGENT! I need to compare a String with a line in a .txt file

    I'm a college student and I have a very simple question i guess. I need to write an if procedure which compares if a line of a .txt file is equal to something, but I just don't know how to do it. HELP!

    What specifically are you asking for? How to compare two strings?
    String s = "cat";
    String t = "Cat";
    if (s.equals(t))
       System.out.println('They are equal');    // does not print out
    if (s.equalsIgnoreCase(t))
       System.out.println('They are equal');    // prints out

  • Write a procedure to find out the data copy is happening or not.

    Good Day all,
    I have two databases called "*Report*" and "*Production*". I have a report database which copy a data from production database. I want to write a Stored procedure to compare the count of one table in both the databases. All the tables are same in both the databases.
    Please note :*
    1. We are writing the procedure to find out the data copy is happening or not and also report database is down or not.
    2. Not all times, the both the count is same, sometimes it take delay to copy the data in report database but report database is not down.
    Please see the query to compare
    _"Report"_
    Select count(*) from trx where date ='03-Oct-2010'
    *"Production"*
    Select count(*) from trx where date ='03-Oct-2010'
    I am suggesting to take a count for every 5 mins and keep in temp table and compare it.
    Thanks
    Nihar

    How are you replicating the data from the production database to the reporting database?
    Wouldn't it make more sense to monitor that replication process rather than counting every row in the table every 5 minutes? That's going to get rather expensive for non-trivial tables. If you are using something like Streams to replicate the data, it would make far more sense to monitor the Streams apply process, to determine when the reporting database it updated as of, than it would to monitor the underlying tables.
    Justin

  • Built-in procdure compare (Directories, initialization parameters, roles ..

    hello all;
    I tried to search about the built-in oracle procedure that compares (Directories, initialization parameters, roles, profiles, tablespaces, users, redo logs) between two different databases but I did find it ..
    So if any on knows it please forward it to me as soon as possible.
    Thanks all.

    Wrong forum. The Database General might be more apropriate. Also you should read this: http://www.catb.org/esr/faqs/smart-questions.html very carefully. If you would have used google before dumping your question here in the wrong forum you might have gotten solutions as well:
    http://www.google.com/search?q=oracle+database+diff
    Also Oracle SQL Developer has a built-in Database diff, you might take a look at it.
    cheers

  • Open sales orders value not updating currectly in sales value of CM

    Hi SAP experts,
    I have an issue some of customers credit exposure value showing worng value.We are using static credit limit check.
    customers credit limit RM20000,
    open sales order valueRM6,073.77
    open delivery=0
    open billing =0
    open items(recievables)=3,464.39
    Credit exposure =9,538.16.
    But i have checked in VA05 its showing 13,001.10 value, i have checked all areas didnt get any solution.
    I have run the reports RVKRED09 and RVKRED77 , RVKRED88 also no updates in the credit management.
    is there any other areas i need to check, advise me.
    Regards,
    Nooka

    The only thing you really need to check is RVKRED88.
    It is not the correct procedure to compare the open sales order value with the sum net value of VA05.
    In VA05 open documents are displayed indifferent whether they are already part-delivered or not. That's why the open values from the VA05 are not directly comparable with the values in RVKRED77.
    As described in OSS note 716141; reports RVKRED88/77 shows the correct value which should be in your system.
    If you need to know more let me know.
    Thanks,
    Gerard

  • Error running comparison report

    In a Demo instance for release 12.1.2 I run the extract for Profiles selection set, then on the same instance, changed some of the profile values and re-run the same extract. When I run the comparison report using both extract files I get the following error message:
    Entity Name: Profile Options
    Ignore Warnings and Continue: No
    Update Existing Records: Yes
    Time Taken(seconds): 89.0
    java.sql.SQLException: ORA-20001: The following PL/SQL exception:
    -1422: ORA-01422: exact fetch returns more than requested number of rows
    occurred in procedure az_comp_reporter.compare
    on this statement:
    procedure end
    ORA-06512: at "APPS.AZ_COMP_REPORTER", line 755
    ORA-06512: at "APPS.AZ_COMP_REPORTER", line 180
    Any help how to troubleshoot this?
    Thanks

    Hi:
    Please check for the report preferences for the key attributes marked for comparison. Also, please log a SR for tracking this issue with development.
    Thanks,
    Lokesh

  • Promotion Number in Sales Order

    Hi all,
    I am using SAP Retail.
    I create Sales Promotion (WAK1) and assign "SP Condition" KA02 - Promo Discount % into this promotion.
    However, when I create sales order (VA01), the promotion number is not determined by the system but the condition KA02 is granted in the pricing procedure.
    Compared with the Sales Promotion (WAK1) created for sales price promotion (VKA1). The promotion number and sales price promotion can be determined correctly in sales order.
    Could you please help to clarify whether the standard SAP can determine promotion number in this case?
    Thank you very much in advance.

    Hi selva
    1)Check in Change Promotion T.code - WAK2
    in the item level   Promotion announcement category(Ann column) - set indicator as F     Promotion announcement
    2)Check sales periods dates - Sales order from to TO it should be valid date
    if not works, reply me i will give some more solutions
    regards
    Satish

Maybe you are looking for

  • Missing Audit Log of Adapter Engine in Message Monitoring

    Hi! I've a problem with a fresh installed PI: The Adapter Engine doesn't log anything in the Message Monitoring. The Integration Engine logs everything properly, but all entries from the adapter engine are missing. It looks like no message was proces

  • IPad 2 convert hdmi out to vga out

    I'm having trouble getting from point A to point B here. I need to output a movie from an iPad 2 to a 4:3 17" VGA monitor AND have the iPad plugged into a power source. The VGA output cable Apple sells does not charge and the HDMI cable that does cha

  • Creative Zen Firmware 1

    What does this actually do. As far as I can tell it allows for an SD card to be used as mass storage. Thats what I got from reading the site but its not at all clear. Secondly I don't have an SD card right now and with all the reports on the forum an

  • Report crashes when table having lots of columns and rows, please help

    Hi, Everyone, Our system is Apex 4.0.2 with Oracle 11GR2 and Oracle HTTP server in the middle. We have a very simple report drawing data from a table with 46 columns ( no binary data) , when the maximun rows is 500, everything is fine; but if I incre

  • Ical doesnt work

    Ical doesnt work . It shut down