SQL Query Help (not working not properly)

Hello everyone,

I use JDeveloper 12.1.2.0.0. I do a two-way communication using 3 tables, with links between them (and using schema HR).

In my example, I have something like:

Departments, employees, and the SalaryByJobs (I created this table where it shows a departmentd id, employee id, salary).

Whenever I click on one OR more departments, the employees up-to-date table by putting on the table, employees who belong to the selected department and the salaryByjob to put the jobs of the employees selected on the employees table.

So it's something like this:

The departments selected-> employees selected-> salarybyjbobs of these employees.

My query used (in the view) has the following code:

SELECT Employees.COMMISSION_PCT,

Employees.DEPARTMENT_ID,

Employees.EMAIL,

Employees.EMPLOYEE_ID,

Employees.FIRST_NAME,

Employees.HIRE_DATE,

Employees.JOB_ID,

Employees.LAST_NAME,

Employees.MANAGER_ID,

Employees.PHONE_NUMBER,

Employees.SALARY

Employees EMPLOYEES

WHERE (department_id IN (select * from THE (select cast (in_list(:variavel3) as mytableType) double) a))

Since I use the links, the employees table does not show anything at the beginning, so I added this to my query used to go: OR nvl(:variavel3,0) = 0

But now, whenever I try to select multiple lines, it gives me the invalid numbers and I don't understand why...

It's only one line of code and it is not in the bean.

Can someone help me?

PS - The bean will Department by Department, adds the departments with ',' and for each Department, gets employees who belongs to them.

My best regards,

Frederico Barracha.

The expression NVL (: variavel3, 0) = 0 is not correct. The data type of the return value of the NVL function is considered to be equal to the data type of the argument of 1 (that is, the data type of the variable binding: variavel3). You said that this variable contained a list separated by commas to ID, so the data type of the variable is VARCHAR2. As long as you compare the NVL expression of a number, you get 'Invalid number' exception, because Oracle expects a numeric data type on the left side of the comparison operator.

To avoid the exception "Invalid number", you can modify the expression by using one of the following options:

: variavel3 IS NULL

NVL (: variavel3, ' *') = ' *'

NVL (: variavel3, ' 0') = '0'

Option 1, so the simplest and clearest.

Dimitar

Tags: Java

Similar Questions

  • Classic report command SQL ORA-00933 not properly completed when you enable sorting

    Hello

    Oracle 11g r2, APEX 4.1.1.00.23.

    I have a few reports of type SQL Query (PL/SQL, returning the SQL query function body), so the source is as follows:
    begin
      return points_ui.get_points_query(:P0_FILTER_TYPE);
    end;
    Without no sort option, the report is made successfully.

    But I got the following error during a test to enable the sorting option for a column:
    ORA-00933: SQL command not properly ended
    I read about this error on the Oracle forums, and I saw it was a bug in an older version, but I thought it was fixed in 4.0.2...

    Any help would be appreciated.

    Thank you.

    Yann.

    The Order By clause and the column sort is kind of mutually exclusive.
    If your SQL in the report area has an Order By inside and you apply the sort order on the columns in the report attributes tab, then errors occur during execution.

    Concerning

  • drop the triggers in the SQL code causes not properly completed order.

    running the following command in SQL developer, giving the following error message
    ORA-00933: SQL not correctly completed command.
    What I am doing wrong
    Begin  
    For I In (Select Trigger_Name, Owner From Dba_Triggers Where Trigger_Name Like 'ABC%' And Owner = 'my_schema')
      Loop  
        Execute Immediate 'DROP TRIGGER '||I.Owner||'.'||I.Trigger_Name;  
      End Loop;  
    End;
    Published by: Mo2 on April 16, 2010 12:21

    Published by: Mo2 on April 16, 2010 12:24

    MO2 wrote:
    Yes he has.
    is an example of the names BIN$ + i6ls2WnR/Svz0wA5LSG8A == $0

    In fact these triggers created by the database after I have remove the tables. is there a way to avoid their creation?

    drop trigger BIN$+i6ls2WnR/Svz0wA5LSG8A==$0;
    drop trigger BIN$+i6ls2WnR/Svz0wA5LSG8A==$0
                     *
    ERROR at line 1:
    ORA-00933: SQL command not properly ended
    

    Yes, oracle complained about it during a fall.
    These objects will be created if you recyclebin on.

    You can either disable your recyclebin or you can purge these items in recyclebin after a fall. Make sure that you require this function or objects in the future.

    Concerning
    Anurag

  • (Updated report) SQL query - may not know how to make one

    Hi people,

    Can someone tell me how to make a report where the data can be updated? Not an interactive report, SQL report that selects a single row. The only options in the menu dropdown I see are "SQL query" and 'SQL Query (body of function from PL/SQL returning SQL query)', but I have a report elsewhere that says: this type are "SQL Query (updated report)", but I do not remember how :(

    Thank you very much

    -Adam

    Hi Adam,.

    An updated report is a 'tabular form' - see: http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/frm_tabular.htm#CHDFBHDB

    Andy

  • SQL query does not work coccrectly

    The table contains the list of months and years.
    When I write
    SOME MONTHS, YEAR FROM MONTH_DETAILS ORDER BY DESC, YEAR DESC;
    It works correctly and returns
    MONTH YEAR
    7 2009
    6 2009
    5 2009
    4 2009
    3 2009
    2 2009
    1 2009
    12 2008
    11 2008
    But when I want to get only the first (month = 7 and year = 2009) and change the query like this
    SOME MONTHS, the YEAR OF MONTH_DETAILS WHERE ROWNUM = 1 ORDER BY YEAR DESC, DESC;
    It returns
    MONTH YEAR
    2 2009
    .
    What is the problem?
    The year and month fields are defined as numbers.
    SELECT MONTH,YEAR FROM (select * from MONTH_DETAILS ORDER BY YEAR DESC,MONTH DESC) WHERE ROWNUM=1 
    

    first make order and apply the rownum on him...

    Ravi Kumar

  • SQL query does not work well

    Hello
    I did a small table with 5 rows and want to make a consult sql using rownum

    so I'm running
    select * from mytable where rownum = 1;
    and it gives me the first line but if I change the 1 to a 2 or 3 or 4 or 5, it is said that there's nothing: S

    why?????????????????????

    But if I change to between 1 and 5, he gave me 4 rows: S: S

    why???????????????????

    Try this:

    SELECT *
    FROM (
       SELECT bne.*, rownum myrow
       FROM BAN_EVENTOS_CONFIRMACION bne WHERE ROWNUM <=5)
    WHERE myrow = 2;
    
  • Production PL/SQL query: can not find the error

    I have a PL/SQL which produces a query for me, which is used to fill out a report. I use this to supply a filter/search form. Since I want to only filter using xxx movies WHERE = yyy when yyy actually has something else NULL, I use a PL/SQL script in the query I need to produce. However, it does not work as expected and I can't understand why. Here is my code:
    DECLARE
      query VARCHAR(1000);
    BEGIN
      query := 'SELECT * FROM F_OBJEKTE WHERE 1=1 ';
      IF :P15_REGION != null THEN
        query := query || 'AND REGION = :P15_REGION ';
      END IF; 
      RETURN query;
    END;
    However, the report still contains all lines, as if P15_REGION has not been defined - and so I guess that the script never enters the IF part. Everyone around who can enlighten me, why it is?

    Just another little thing: is there a way I can print debugging messages I see when I press the "Debug" button on the lower bar of APEX? It would help a lot of debugging such PL/SQL functions.

    Try changing

    IF: P15_REGION! = null THEN

    TO

    IF: P15_REGION is not null THEN

  • Why the result of the SQL query is not displayed in the HTML text box?

    Hello

    Under query result appears in home > workshop SQL > SQL commands.

    Select t.nom
    of pm_task t
    where: P5_Project_id = t.project_id
    and: P5_task_id = t.id

    But when the same code is run through EditRegion of HTML text box > region definition > sources > Source region, the result is not displayed.
    Why is this so, and what is the solution?

    Thank you
    Guy

    You need a report from the region for this ;) A region of HTML is to display a static text or page items.

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • SQL query does not run...

    Hi all

    In fact I'm trying recover the data of the mobile database table in the code snippet

    below the program runs until the dialog box display the string «after querry» and after that

    throw an exception.

    can anyone solve the problem...

    try
    {
    //URI myuri = URI.create("file:///SD Card/databases/myTree/myTeam.db");
    URI myuri = URI.create("file:///SDCard/databases/myTree/"+"myTeam.db");
        Dialog.alert("Database opened");
        Dialog.alert("Database opened");
        data = DatabaseFactory.openOrCreate(myuri);
        Dialog.alert("before query");
        st = data.createStatement("SELECT * FROM mobile WHERE name="+text);
        Dialog.alert("After querry");
        st.prepare();
        Cursor c = st.getCursor();
        int i = 0;
        Dialog.alert("Before while");
        while(c.next())
        {
            Dialog.alert("in the while");
            r = c.getRow();
            i++;
    Dialog.alert(r.getString(0)+r.getString(1)+r.getString(2)+r.getString(3));
            //name1.setText(r.getString(0));
            //email1.setText(r.getString(1));
            //phone1.setText(r.getString(2));
            //skype1.setText(r.getString(3));
        }
        st.close();
        data.close();
    }
        catch (Exception e)
        {
        e.printStackTrace();
        Dialog.alert(e.toString());
    }
    

    Thanks in advance...

    Saran

    Well, it would be useful if we can say which line threw the exception and if you could be a little more specific about what 'some exception' is in reality.

    I think, however, is that the problem is how you create your declaration. Instead of directly in the statement of interpolation "text":

    st = data.createStatement("SELECT * FROM mobile WHERE name="+text);
    

    You must create a query that contains a placeholder for text and then bind the text of the statement:

    st = data.createStatement("SELECT * FROM mobile WHERE name=?");
    st.prepare();
    st.bind(1, text);
    

    If this solves the problem, it's how you build such declarations in all cases.

  • The join SQL query help

    I'm just having a bit of troubel get a correct join query - I thought it was an Inner Join, but I don't get the results I expect.

    My table structure is:

    Table: lodges

    LodgeID (PK)

    Lodge

    etc.

    Table: implemented application

    NominationID (PK)

    Category

    LodgeID

    Year

    So I try to use this structure to replicate this page:

    http://www.safariawards.com/nominees12/

    That is to say a list of boxes for each category, they are appointed on.

    The query I've tried looks like this:

    SELECT appointments. LodgeID, lodges. Lodge, applications. NominationID, applications. Lodges INNER JOIN applications category IT lodges. LodgeID = nominated. NominationID WHERE category = "Best property of Safari in southern Africa" ORDER BY Lodge

    But this product:

    http://www.safariawards.com/nominees12/southernafrica.php

    Its the right number of results, but not the list on the right of the boxes - for example British Airwways is not LodgeID 786

    If anyone could help with the SQL right for what would be well appreciated.

    That you join on the wrong column. Try this:

    SELECT appointments. LodgeID, lodges. Lodge, applications. NominationID, applications. Lodges INNER JOIN applications category IT lodges. LodgeID = nominated. LodgeID WHERE category = "Best property of Safari in southern Africa" ORDER BY Lodge

  • Join SQL query help

    I have two DEVICE and CONTACT tables. The tables are joined for CONTACT_ID DEVICE_ID. I want to print device_ID and the corresponding coordinates on the lower contact. PRIORITY.
    SQL> describe DEVICE;
    DEVICE_ID              NOT NULL VARCHAR2(50)
    
    SQL> describe CONTACT;
    CONTACT_ID               NOT NULL VARCHAR2(50)
    CONTACT_TYPE             NOT NULL VARCHAR2(4)
    PRIORITY                 NOT NULL DOUBLE PRECISION
    LASTNAME                 NOT NULL VARCHAR2(30)
    FIRSTNAME                NOT NULL VARCHAR2(80)
    
    SQL> SELECT a.DEVICE_ID, b.LASTNAME,b.PRIORITY from DEVICE a, CONTACT b where a.DEVICE_ID = 'DEVICEA' and a.DEVICE_ID=b.CONTACT_ID(+);
    DEVICE_ID              LASTNAME    FIRSTNAME PRIORITY CONTACT_TYPE
    ---------------------- ----------- --------- -------- ------------
    DEVICEA                CONTACT1     GN               1 ROUT
    DEVICEA                CONTACT2     Hans             2 ROUT
    How to print a single record with the CONTACT the lowest. PRIORITY?

    Thank you
    Ravi

    rmalghan wrote:
    Thank you Frank, Sundar and Sean. I had less than 3 to work. Two questions. My table of DEVICES has 31936 records.
    1. the first one returned 30207, 31936 records 2nd and 3rd a 30348. Since the 2nd result resembles what I expected, the 1st and 3rd one seem to miss some records. For troubleshooting, I tried to limit the query to a few devices, but do not understand why the difference. Any suggestions?

    The 2nd query not check for type_contact = 'ROUT', it is not surprising that it returns more rows.
    The request of 3rd fact actually an inner join. The "WHERE c.rnum = 1" condition is applied after the join, so he rejects all rows that have been added due to the outer join (which is where all the columns of c are NULL). You probably meant to say:

    LEFT OUTER JOIN got_rnum c ON  d.DEVICE_ID     = c.CONTACT_ID
                               AND c.rnum          = 1; 
    

    without a WHERE clause.

    2. are there advantages in terms of efficiency. 2nd one does not seem to run faster, so I think it's the best. Any comments?

    SELECT a.DEVICE_ID, b.LASTNAME,b.FIRSTNAME,b.PRIORITY
    FROM DEVICE a, CONTACT b
    where
    a.DEVICE_ID=b.CONTACT_ID(+) and
    b.CONTACT_TYPE = 'ROUT' and
    b.PRIORITY = (select min(b1.PRIORITY ) from CONTACT b1 where b1.CONTACT_ID = b.CONTACT_ID);
    
    30207 rows selected (10.12 seconds)
    
    SELECT DEVICE_ID, LASTNAME, PRIORITY
    FROM (
    SELECT a.DEVICE_ID, b.LASTNAME, b.PRIORITY, ROW_NUMBER() OVER (PARTITION BY a.DEVICE_ID ORDER BY b.PRIORITY) row_num
    from DEVICE a, CONTACT b
    where a.DEVICE_ID=b.CONTACT_ID(+))
    WHERE row_num = 1;
    
    31936 rows selected (6.68 seconds)
    
    WITH got_rnum AS (
    SELECT LASTNAME, FIRSTNAME, PRIORITY, CONTACT_TYPE, CONTACT_ID,
    ROW_NUMBER () OVER ( PARTITION BY  CONTACT_ID ORDER BY priority) AS rnum
    FROM contact
    where CONTACT_TYPE = 'ROUT'
    )
    
    SELECT d.DEVICE_ID, c.LASTNAME, c.FIRSTNAME, c.PRIORITY
    FROM device d
    JOIN got_rnum c ON d.DEVICE_ID     = c.CONTACT_ID(+)
    WHERE c.rnum = 1; 
    
    30348 rows selected (9.07 seconds)
    

    This calendar is not very accurate. One that you run first is likely to be slower, because the data are less likely to be stored in the memory cache.

    The 2nd query has only 3 columns in the result set. Which probably doesn't change the speed a lot, but you should fix it anyway.

  • SQL query - help with join

    Dear friends,

    Version of DB - 11.1.0.7... , I'm stuck with SQL basics today... need your help...

    The slot SQL tells me "cache them locks library" in the database that I will put up as a proactive measure.

    I'll be it works via shell script and include the table gv instance_name $ instance ... I'm a little confused as to how a 3rd table "gv$ instance ' can be introduced into the query in order to make the instance_name in the result set...

    SELECT * FROM)

    SELECT / * + LEADING (a) USE_HASH (u) * /.

    instance_name, INST_ID select, blocking_inst_id, blocking_session, username, session_id, sql_id, current_obj #,.

    DECODE (sql_opcode, 1, 'CREATE TABLE', 2, 'INSERT') as "order."

    Event, mod(P1,16) p1, p2, p3

    COUNT (*) totalseconds

    , SUM (CASE WHEN wait_class = 'Application' THEN 1 ELSE 0 END) 'Application '.

    Of

    (SELECT

    a.*

    , TO_CHAR (CASE WHEN session_state = 'WAITING' THEN ELSE null END p1, '0XXXXXXXXXXXXXXX') p1hex

    , TO_CHAR (CASE WHEN session_state = "PENDING" THEN p2 ELSE null END, '0XXXXXXXXXXXXXXX') p2hex

    , TO_CHAR (CASE WHEN session_state = "PENDING" THEN ELSE null END p3, '0XXXXXXXXXXXXXXX') p3hex

    SGS $ active_session_history one) a

    u dba_users

    WHERE

    a.user_id = u.user_id

    AND sample_time BETWEEN sysdate-90 /(24*60) AND sysdate

    - AND a test of ('library cache lock', 'library cache pin")

    AND event like '% library '.

    GROUP BY

    INST_ID select, blocking_inst_id, blocking_session, username, session_id, sql_id, current_obj #,.

    DECODE (sql_opcode, 1, 'CREATE TABLE', 'INSERT', 2),

    event, mod (p1, 16), p2, p3

    Having count (*) > 5

    ORDER BY

    TotalSeconds DESC

    , INST_ID select, blocking_session, username, session_id, sql_id, current_obj #, 'Order', event

    )

    WHERE

    ROWNUM < = 20

    /

    replace

    instance_name

    by

    (select instance_name gv$ instance where INST_ID select = a.inst_id) instance_name

    or select... in... a, u, gv$ instance where... and gv$ instance.inst_id (+) = a.inst_id...

  • SQL query help (we connect by clause level)

    Hi all
    I have this application developed with data with the clause.
     With dat As
    (
      select '@AAA @SSS @DDD' col1 from dual union all
      select '@ZZZ @XXX @TTT @RRR @ZZA' col1 from dual 
    )
    Select regexp_substr( col1 , '[^@][A-Z]+',1,level) Show from dat
    connect by level  <= regexp_count(col1, '@');
    Output current: -.
    SHOW
    -----------------------
    AAA
    SSS
    DDD
    RRR
    ZZA
    TTT
    RRR
    ZZA
    XXX
    DDD
    RRR
    
    SHOW
    -----------------------
    ZZA
    TTT
    RRR
    ZZA
    . . .
    . . .
    1st row comes very well, but the next line data copy. And the number of total records = 30. I tried with some, but not worked.
    Expected results: -.
    SHOW
    -----------------------
    AAA
    SSS
    DDD
    ZZZ 
    XXX 
    TTT 
    RRR 
    ZZA
    I need some changes on my request and I am not able to see that. So anyone can add to that or can also provide a different solution also.

    Thank you!
    Ashutosh

    Thanks for providing the loan to the use of query. :)

    Here's a solution :-(tested on 10 g, do not have 11 g at hand)

    For 11g, just use regexp_count instead of functions of the length.

    With dat As
    (
      select '@AAA @SSS @DDD' col from dual union all
      select '@ZZZ @XXX @TTT @RRR @ZZA' col1 from dual
    )
    Select regexp_substr( col, '[^@][A-Z]+',1,level) Show from dat
    connect by nocycle level  <= length(col) - length(translate(col, 'A@', 'A'))
           and col = prior col
           and prior sys_guid() is not null;
    
    SHOW
    ------------------------
    AAA
    SSS
    DDD
    ZZZ
    XXX
    TTT
    RRR
    ZZA                      
    
     8 rows selected
    
  • SQl query help please...

    Hello

    I have a requirement... can help you pleease

    I have a table with two columns called Doc R, Seq R

    Sampled data:
    Type          Doc R           Seq R
    --------        ---------        ------------
    R                R1               Null
    Q               Q1                R1
    R                R2               Null
    Q               Q2               R2
    R                R3               Null
    Q               Null              Null
    
    
    Now  if you see first two records R1 and R2 have corresponding Q2.....
    if you see R3 dont have Q values..
    
    Now i want the count of R3 like records where it does not have Corresponding Q values in ...
    
    any ideas please...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hello

    Another way, which could be more efficient (but less clear):

    WITH   got_grp         AS
    (
         SELECT     CASE WHEN rtype = 'Q' THEN seq_r ELSE doc_r END     AS grp
         ,     CASE WHEN rtype = 'Q' THEN 0     ELSE 1     END     AS r_val
         FROM     yourtable
         WHERE     rtype  IN ('Q', 'R')
    )
    SELECT       COUNT (COUNT (*))     AS grp_cnt
    FROM       got_grp
    GROUP BY  grp
    HAVING       COUNT (*)     = SUM (r_val)
    ;
    

    You have not said if a line where
    rtype = 'R' and doc_r has the value NULL is considered to be a match for a line where
    rtype = 'Q' and seq_r is NULL.

    In the application of Cyn, they are not a match.
    In the above query, they are.
    A query can be changed for a different result.

  • Conversion of SQL Query Help

    Hello, I'm doing a migration of SQL Server T - SQL to oracle 11 g PL/SQL, and I don't want to use a global temporary table; Instead, consider using sliders and pl/sql table.

    I got hit in a scenario where I need to convert the following in a single sql statement.

    Stage of T - SQL:
    ============

    Insert (#ActCde)
    InvntrySbLdgrChngeID
    DlHdrID
    DlDtlID
    ChemID
    StrtgyID
    Quantity
    Value
    Modified)
    Select InvntrySbLdgrChngeID
    DlHdrID
    DlDtlID
    ChildPrdctID
    StrtgyID
    VolumeChanged
    ValueChanged
    , 'N'
    of InventorySubLedgerChange
    where LastInChain = 'Y '.

    -updated column "Changed" of particular documents to 'Y' based on conditions

    Update #ActCde
    Changed the value = 'Y '.
    of #ActCde (nolock)
    Left Outer Join InventorySubledgerDetail ISD (nolock)
    on #ActCde.DlHdrID = DSI. DlDtlChmclDlDtlDlHdrID
    and #ActCde.DlDtlID = ISD. DlDtlChmclDlDtlID
    and #ActCde.ChemID = DSI. DlDtlChmclChmclChldPrdctID
    and #ActCde.StrtgyID = DSI. StrtgyID
    and the DSI. AccntngPrdID = @i_AccntngPrdID - variable parameter
    Where abs (#ActCde.Qty - isnull (ISD.) BeginningVolume, 0)) >.01
    or abs (#ActCde.Value - isnull (ISD.) BeginningValue, 0)) >.01
    or (abs(#ActCde.Qty) = 0 and)
    ABS(#ActCde.value) = 0 and
    ABS (isnull (ISD. BeginningVolume, 0)) = 0 and
    ABS (isnull (ISD. BeginningValue, 0)) = 0
    )

    Convertion of SQL:
    ===============
    I would like to do something like

    Select A.InvntrySbLdgrChngeID,
    A.DlHdrID,
    A.DlDtlID,
    A.ChemID,
    A.StrtgyID,
    A.Qty,
    A.Value,
    A.Changed
    Of
    (select InvntrySbLdgrChngeID
    DlHdrID
    DlDtlID
    ChildPrdctID AS ChemID
    StrtgyID
    VolumeChanged AS Qty,
    ValueChanged value have
    , 'N'
    of InventorySubLedgerChange
    where LastInChain = 'Y') A LEFT OUTER JOIN InventorySubledgerDetail B
    ON A.DlHdrID = B.DlDtlChmclDlDtlDlHdrID
    and A.DlDtlID = B.DlDtlChmclDlDtlID
    and A.ChemID = B.DlDtlChmclChmclChldPrdctID
    and A.StrtgyID = B.StrtgyID
    and B.AccntngPrdID = i_AccntngPrdID - parameter varibale
    Where abs (A.Qty - isnull(B.BeginningVolume,0)) >.01
    or abs (A.Value - isnull(B.BeginningValue,0)) >.01
    or (abs (A.Qty) = 0 and)
    ABS (A.value) = 0 and
    ABS (IsNull(B.BeginningVolume,0)) = 0 and
    ABS (IsNull(B.BeginningValue,0)) = 0
    )

    And I need to change the 'A.CHANGED' column value 'Y', based on the outer join, as is above T - SQL.

    IF this wont work so pls help me to another way to do this.

    in this regard, your help is appreciated.

    Thank you!

    SS

    Try this

    select #ActCde.InvntrySbLdgrChngeID
           , #ActCde.DlHdrID
           , #ActCde.DlDtlID
           , #ActCde.ChildPrdctID
           , #ActCde.StrtgyID
           , #ActCde.VolumeChanged
           , #ActCde.ValueChanged
           , case when abs(#ActCde.Qty - isnull(ISD.BeginningVolume,0)) > .01  or
                       abs(#ActCde.Value - isnull(ISD.BeginningValue,0)) > .01 or
                       (
                             abs(#ActCde.Qty)                   = 0 and
                             abs(#ActCde.Value)                 = 0 and
                             abs(isnull(ISD.BeginningVolume,0)) = 0 and
                             abs(isnull(ISD.BeginningValue,0))  = 0
                       )
                  then 'Y'
                  else 'N'
             end changed
      from InventorySubLedgerChange #ActCde
      Left Outer Join InventorySubledgerDetail ISD (nolock)
        on #ActCde.DlHdrID = ISD.DlDtlChmclDlDtlDlHdrID
       and #ActCde.DlDtlID= ISD.DlDtlChmclDlDtlID
       and #ActCde.ChemID = ISD.DlDtlChmclChmclChldPrdctID
       and #ActCde.StrtgyID = ISD.StrtgyID
       and ISD.AccntngPrdID = @i_AccntngPrdID - paramenter variable
     where LastInChain = "Y"
    

Maybe you are looking for

  • 20 - c012a: pop ups

    Hi I was wondering if there is anyway I can stop hp "Welcome to your new hp" of poping up every time. I hit the done button and he disappears, but returned shortly after.  It is the image that I want to talk. Thank you bunch of Kate

  • load cell 9237 + full-bridge: load cell_null_off_shuntcal.vi - error 200077

    I try to use load_cell_null_off_shuntcal.vi with load cell (Honeywell model 31, not amplified). I'm using LabView 8.6, cDAQ-9172 and NI9237. Entries: excitation10V internal; mV/V 2.1492 (calib. bin); weight 10 lbs max. resistance bridge 350 ohms (Hon

  • Unable to see recentExcel files of the window pinned in the taskbar

    I came to the office today and I am unable to see all the excel files recent of the axis of the taskbar. Documents Word & powerpoint are visible. Only excel doesnot show any docs.  Help, please. I use excel 90% of the time at work and this problem is

  • Disable auto-capitalisation in text field

    I do a text field, but I don't want the first letter capitalized. None of the types of entry is not really what I want. It was suggested in another thread that define addresses worked and do not add a symbol or .com to the keyboard (http://supportfor

  • drivers not working is not for my hp 15-d018tu... Help

    Hello..I recently bought a new hp PC laptop 15-d018tu... First I used Win 8... That I changed the window for Win 7... BT after downloaded and installed all the drivers from Hp... Controller and PCI network drivers remain to be installed that i cudnt