LabVIEW sql query

HI HI... I'm a student doing a project related to labview. My task is to create a vi, type a user name and password to continue the whole VI.

As I am a newbie to SQL query language, can anyone help me this?... This isn't like the VI with password lock

There is a connection of the user called button in my main façade... u by clicking on it, a pop-up window will come out asking you a user name and a password. If the user name and the password is correct, then you can proceed. The problem is that I'm stuck with database...
Help me pls!

with respect,

Ray

Hello

You have two cases:

(1) connect to the database with string (link a string of connection information), and then type something like this:
Driver is SQL Native Client;. Server = IP. Add.re.SS; UID = username; PW = *** ; Database = MyDatabase (depends on your database)

(2) use a UDL file (you can configure it to connect to your database, with specific format). Remember that the connection is successful with test button.

There is a UDL file that you can edit here: C:\Program NIUninstaller Instruments\LabVIEW 2010\examples\database\Labview.udl

Edit: The connection dropped, you can set the path to an mdb file, and I think you can give the path of your accdb file.

Kind regards

Tags: NI Software

Similar Questions

  • Œuvres SQL query to MS SQL Server 2008, but not when you use the database kit

    I have this SQL query:

    DECLARE TABLE (@DataTypeTable)
    Name varchar (128).
    TypeID INT)

    -Add comma delimeted type data in the temporary table names
    INSERT INTO @DataTypeTable (name)
    SELECT * from WhatWeShouldDoRead.func_Split (@DataTypeTrimmed, ',')

    SELECT the name OF @DataTypeTable

    That takes a comma delimited by the string and returns the string as a table.  It works correctly in Microsoft SQL Server Management Studio.  When I run this as a stored procedure I return nothing.  There are no errors, SQL or otherwise.  I checked that I am connected to the correct database and the stored procedure is responsible without changing any error chain which is reported of this stored procedure (that code is not shown in the example above).  Has anyone seen this problem before, or have experience with SQL/Labview interfaces to tell me what I am doing wrong?

    Thanks in advance.


  • SQL query for empty string

    I am trying to execute the following SQl query, SELECT * failure WHERE ID = '123 ' AND RepairAction =' '; using the DB tools run Query.vi. This query never find record in my database. My database contains a record where the registered ID contains the value '123' and the RepairAction field is an empty string. If I remove the declaration 'AND RepairAction' ';' my query text, the record is found. I think my problem is that I do not use the correct syntax to describe and an empty string. I tried the following: "," ",""," "and NULL as empty and none of these work string arguments.

    I was hoping someone might be able to tell me what the correct syntax is an empty string or if there is another approach that I take.

    Thanks in advance for your help,

    Jim

    Jim,

    Just to be sure, have you used 'is' instead of '=' in this command?

    This makes all the difference in this command.

    Cerati

  • Support of SQL query: what tasks are Sunday from 07:00 - 12:00

    Hello tide Admins.

    I need to do a SQL query that can give me a list of jobs that are running on a given (Sunday) day from 07:00 - 12:00.  Our environment is not a maintenance window.  Therefore, whenever there is application of patches or upgrades, it causes more work and risk of failure of the tide tasks.    By moving jobs over the period from 07:00 - 12:00 Sunday, patch can be completed without disrupting the calendar.

    Im not the best at the SQL script and can not get my script to work. any help would be great. Here's what I have so far.  I get the error ' could not find identifier multi-player jobmst.jobmst_name.  IM using Tidal 6.0.3 with SQL for DB Admeral table.

    SELECT dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name

    FROM dbo.jobdtl INNER JOIN

    dbo.jobmst ON dbo.jobdtl.jobdtl_id = dbo.jobmst.jobdtl_id

    WHERE (dbo.jobdtl.jobdtl_fromdt > 14 September 2016 06:00 ') AND (dbo.jobdtl.jobdtl_fromdt< '09/11/2016="" 012:00:00="">

    GROUP OF dbo.jobdtl.jobdtl_id, dbo.jobmst.jobmst_prntname, dbo.jobmst.jobmst_name

    Hi Jeff

    The time window from the jobdtl returns only jobs that have an early start time and windows of time from beginning to the end, so there may be some tasks which are not time bound but have dependencies on other jobs, variables, etc.

    Here are the 2 SQL queries against the table jobrun and jobmst:

    -The list of jobs that took place last Sunday between 07:00 and 12:00

    SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_time FROM jobrun
    JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
    WHERE jobrun.jobrun_time > = 9/11/2016 07:00 ' and jobrun.jobrun_time<= '9/11/2016="" 12:00="">
    ORDER BY jobrun.jobrun_time

    -For a list of jobs that are scheduled to run on Sunday to come between 07:00 and 12:00

    SELECT jobmst.jobmst_prntname, jobmst.jobmst_name, jobrun.jobrun_esttime FROM jobrun
    JOIN jobmst on jobrun.jobmst_id = jobmst.jobmst_id
    WHERE jobrun.jobrun_esttime > = 9/18/2016 07:00 ' and jobrun.jobrun_esttime<= '9/18/2016="" 12:00="">
    ORDER BY jobrun.jobrun_esttime

    ARO

    The Derrick

  • How to get the value of a column in sql query?

    Hi, anyone knows how to get the value of a column in sql query?

    Here is my code, the value must be 1350079224397 in my PB, but I get 0

    QString query ("SELECT version FROM db_version");

    QVariant result = sda.execute (query);
    QVariantMap versionMap = result.toList () such () .toMap ();
    If (! versionMap.IsEmpty ())
    {
    qDebug()<"Version: "=""><>
    }

    OK, I have the solution

    QString query ("SELECT version as version FROM db_version");

  • Looking for a SQL query to retrieve callvariables + ECC to a RESULTS of SCRIPT EXECUTE (translation VRUS)

    Hi team,

    I'm looking for a SQL query check data (ECC + CallVariable) due to a RESULT of SCRIPT EXECUTE when you ask an external VRU with a translation route to VRU with a 'run external Script '.

    In my view, that the data are analyzed between the termination call detail + termination call Variable.

    If you have already such a SQL query I would be very grateful to have.

    Thanks and greetings

    Nick

    Omar,

    respectfully, shorten the interval of a day might not be an option for a history report ;-)

    I recommend to take a look at the following SQL query:

    DECLARE @dateFrom DATETIME, @dateTo DATETIME

    SET @dateFrom = ' 2014-01-24 00:00:00 '

    SET @dateTo = ' 2014-01-25 00:00:00 '

    SELECT

    TCV. DateTime,

    TCD. RecoveryKey,

    TCD. RouterCallKeyDay,

    TCD. RouterCallKey,

    VME. EnterpriseName AS [ECVEnterpriseName],

    TCV. ArrayIndex,

    TCV. ECCValue

    OF Termination_Call_Variable tcv

    JOIN THE

    (SELECT RouterCallKeyDay, RouterCallKey, RecoveryKey IN Termination_Call_Detail WHERE DateTime > @dateFrom AND DateTime)< @dateto)="">

    THE tcv. TCDRecoveryKey = tcd. RecoveryKey

    LEFT OUTER JOIN Expanded_Call_Variable VME ON tcv. ExpandedCallVariableID = VME. ExpandedCallVariableID

    WHERE the tcv. DateTime > @dateFrom AND tcv. DateTime<>

    With variables, you can set up your code (for example, you could write SET @dateFrom =? and let the calling application to fill in the DateTime for you).

    In addition, join two large tables with all the lines, as you did (TCD - TCV) is never a good option.

    Another aspect to consider: all the ECC is actually arrays (always), is not good to leave aside the index value (tcv. ArrayIndex).

    G.

  • DA on updatable report items Sql query using the class

    Request Express 4.2.5.00.08

    10-11 g Oracle

    I have a page, so it has a link/button when he clicks then modal region will appear. Modal region has a as a table (Type SQL Query (updateable report)). All work very well so far.


    However, I've now added some complex things.

    for example. My region is based on the query of SQL Type (editable report).

    SELECT id, name of family, Traghetti, area, d_date, start_time, End_time, displacement, role of table where id =: P10_ID;

    I can also add a new line of course.

    My problem is, (point) Shift display based on the value of Start_Time point) and so I made sure the class for two items.

    for example, Start_Time (' class = "st_tm" ') and Maj ('class to = "Shift_time" '). Start_Time is based on (LOV) and shift is off the point in the sql query, but change the Start_Time.

    And now, I created the DA.

    1. event: change

    Selection type: jQuery Selector

    jQuery Selector: .st_tm

    Condition: No.

    1. action: set value

    Set type: Expression Javascript

    The JavaScript Expression: $(this.triggeringElement) .val ();

    The element affected: P10_X1 (it is a hidden item)

    2. action: Plsql Code

    Code: start to null; end;

    Page items to submit: P10_X1

    3. action: Plsql Code

    Code: start

    If: P10_X1 between '03' AND '11' then

    : P10_X1: = 'EARLIES ';

    elsif: P10_X1 then '12' and '18'

    : P10_X1: = 'LATES ';

    on the other

    : P10_X1: = 'NIGHTS';

    end if;

    end;

    Page items to submit: P10_X1

    NOW another DA

    Event: change

    Article (s) P10_X1

    Condition (in list)

    value (HASTY, LATES, NIGHTS)

    Action:

    Set type: Expression Javascript

    The JavaScript Expression: $(this.triggeringElement) .val ();

    Affected item:

    Selection type: jQuery Selector

    jQuery Selector:. Shift_time

    Well, I look forward all the above work well, but I'm having a problem.

    If I have more than 1 lines on a modal region and if I change the Start_Time value for a row then MAJ (point) is changing but he effect on all lines.

    I want, if I make the changes on the line line # 2 while only 2 # MAJ (point) must be not performed any other lines?

    Help, please!

    Kind regards

    RI

    I found the solution me thank you.

    I removed all the DA mentioned above and created a new.

    1. event: change

    Selection type: jQuery Selector

    jQuery Selector: .st_tm

    Condition: No.

    Scope of the event: dynamic and light on page load.

    Action (Javascript code)

    ROW_ID = $(this.triggeringElement).attr('id').substr (4);

    If ($(this.triggeringElement). val() > = 03 &. val() $(this.triggeringElement))<= 11)="">

    .Val ('EARLIES') $(«#f11_» + row_id);

    }

    ElseIf ($(this.triggeringElement). > 11 val() & $(this.triggeringElement). val())<= 18)="">

    .Val ('LATES') $(«#f11_» + row_id);

    }

    ElseIf (. val() > $19 (this.triggeringElement)) {}

    .Val ('NIGHTS') $(«#f11_» + row_id);

    }

    also created another DA because I have a disabled report items.

    Event: before the page is sent.

    $('_:_disabled').removeAttr ("disabled");

    and finally created manual process of DML for tabular and everything works fine. (Insert, Update, and delete).

    Kind regards.

  • SQL query to retrieve only numbers to a string variable

    Dear all Experts,

    I have a requirement in one of my projects where I need to extract only the numbers present in the variable.

    for example:

    BANK_ACCOUNT_NUMBER = 12345-67890';

    BANK_ACCOUNT_NUMBER = 12345 67890';

    BANK_ACCOUNT_NUMBER = "123.456.7890";

    BANK_ACCOUNT_NUMBER = 123-A456BC7890D';


    In all these cases, I need to retrieve only numbers such as BANK_ACCOUNT_NUMBER = 1234567890 and I am looking for SQL query only.


    Please suggest me the query how to extract numeric values from varchar variable.



    Thank you

    Knockaert

      select regexp_replace('123-A456BC7890D','[^0-9]') from dual;
    

    See you soon,.

    Manik.

  • Calculation of the time wall of a SQL query.

    Hello

    While trying to discover the time of running a SQL query (wall time) I read in one place that CPU_TIME/EXECUTIONS of v$ SQLAREA, is the precise runtime we can come close to.

    I can't use "set timing on ' or 'DBMS_UTILITY. GET_TIME' that I need to extract the execution time of the story because the query will be drawn to an end, and I need to know how long it took to DB level and compare it with the end time before calculating the % of time used in the DB level total.

    Maybe another way to track sessions and the user TKPORPOF but now I donot want to take the help of the ADMINISTRATOR at this initial stage.

    Is CPU_TIME/EXECUTIONS of v$ SQLAREA where (SQL_TEXT) AS "SELECT... OF... %'; should be enough?

    user2925917, yes as Brian already answered your understanding as posted above seems correct.  Except in the case where there has been only a running query you will download an average time.  The problem with averages is that one or two unusual executions that can skew the average, but in most cases the average will be probably fairly accurate.

    - -

    HTH - Mark D Powell.

  • How to do a validation based on the SQL query?

    Hello

    I have a requirement to perform a validation on a field (messageTextinput) in my page OAF.

    When I click the button apply, the value in this field is validated based on a SQL query (for example, the value in the field NOT IN (value1 select from table1).)

    Help, please.

    Best regards

    Joe

    1. create a SQL query based VO, XXVO. For example:-SQL query is select xx_table;

    2. Enter the "Apply" button click event in the controller and run the AM method passing the value entered by the user in the given field, for example:-value is VAL1

    3. in the method of the AM, get a handle of the VO, the whereClause and run.

    OAViewObjectImpl vo = findViewObject ("XXVO1"); XXVO1 is the name of the instance of the VO above, XXVO

    vo.executeEmptyRowSet ();

    vo.setWhereClause (null);

    vo.setWhereClause ("value =" + VAL1 + "'");

    vo.executeQuery ();

    If (VO. GetRowCount() > 0)

    A record is with the value of VAL1. Perform the required action

    I hope this helps.

  • Single SQL query for the analysis of the date of customs declaration under the table of Stock codes

    Dear all,


    Please tell us a single SQL query for the below,

    We have a Table of Stock as shown below,

    STOCK_TABLE

     

    ITEM_CODE

    (item code)

    BAT_NO

    (lot no.)

    TXN_CODE

    (transaction code)

    DOC_NO

    (number)

    BOE_DT

    (date of the customs declaration)

    I1

    B1

    I1

    I2

    I3

    B70

    I4

    B80

    I5

    B90

    T102

    1234

    JULY 2, 2015

    I6

    B100

    We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).

    For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.

    1. If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).

    2. If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.

  • If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.

  • If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
  • HISTORY_TABLE

     

    ITEM_CODE

    BAT_NO

    TXN_CODE

    DOC_NO

    UPDT_DT

    I1

    B1

    T1

    1234

    JANUARY 3, 2015

    I1

    B20

    T20

    4567

    MARCH 3, 2015

    I1

    B30

    T30

    7890

    FEBRUARY 5, 2015

    I2

    B40

    T20

    1234

    JANUARY 1, 2015

    TRANSACTION

     

    TXN_CODE

    TXN_TYPE

    T1

    IN

    T20

    OFF

    T30

    ALL THE

    T50

    IN

    T80

    IN

    T90

    IN

    T60

    ALL THE

    T70

    ALL THE

    T40

    ALL THE

    IN_TABLE_HEAD_1

     

    H1_SYS_ID

    (primary key)

    TXN_CODE

    DOC_NO

    DOC_DATE

    H1ID1

    T1

    1234

    JANUARY 1, 2015

    H1ID2

    T70

    1234

    FEBRUARY 1, 2015

    IN_TABLE_ITEM_1

     

    I1_SYS_ID

    H1_SYS_ID

    (foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)

    ITEM_CODE

    I1ID1

    H1ID1

    I1

    I1ID2

    H1ID1

    I100

    I1ID3

    H1ID2

    I3

    IN_TABLE_BATCH_1

     

    B1_SYS_ID

    TXN_CODE                DOC_NO

    (now in IN_TABLE_HEAD_1)

    BAT_NO

    B1ID1

    T1

    1234

    B1 / can be empty

    B1ID2

    T70

    1234

    B70

    IN_TABLE_HEAD_2

     

    H2_SYS_ID

    (primary key)

    TXN_CODE

    DOC_NO

    DOC_DATE

    H2ID1

    T30

    4567

    FEBRUARY 3, 2015

    H2ID2

    T60

    1234

    JANUARY 3, 2015

    IN_TABLE_ITEM_2

     

    I2_SYS_ID

    H2_SYS_ID

    (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2)

    ITEM_CODE

    I2ID1

    H2ID1

    I1

    I2ID2

    H2ID1

    I200

    I2ID3

    H2ID2

    I2

    IN_TABLE_BATCH_2

     

    B2_SYS_ID

    I2_SYS_ID

    (foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)

    BAT_NO

    B2ID1

    I2ID1

    B30 / null

    B2ID2

    I2ID2

    B90

    B2ID2

    I2ID3

    B60

    IN_TABLE_HEAD_3

     

    H3_SYS_ID

    (primary key)

    TXN_CODE

    DOC_NO

    DOC_DATE

    H3ID1

    T50

    1234

    JANUARY 2, 2015

    H3ID2

    T80

    1234

    JANUARY 3, 2015

    H3ID3

    T90

    1234

    JANUARY 4, 2015

    H3ID4

    T40

    1234

    AUGUST 5, 2015

    IN_TABLE_ITEM_3

     

    I3_SYS_ID

    H3_SYS_ID

    (foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)

    ITEM_CODE

    BAT_NO

    I3ID1

    H31D1

    I2

    B50

    I3ID2

    H3ID2

    I4

    B40

    I3ID3

    H3ID3

    I4

    I3ID4

    H3ID4

    I6

    There is no IN_TABLE_BATCH_3

    Please find below the expected results.

    OUTPUT

     

    ITEM_CODE

    BAT_NO

    TXN_CODE

    DOC_NO

    BOE_DT

    BATCH_YN

    I1

    B1

    T1

    1234

    JANUARY 3, 2015

    THERE

    I1

    B30

    T30

    7890

    FEBRUARY 5, 2015

    N

    I2

    B60

    T60

    1234

    JANUARY 3, 2015

    N

    I3

    B70

    T70

    1234

    FEBRUARY 1, 2015

    THERE

    I4

    T90

    1234

    JANUARY 4, 2015

    N

    I6

    T40

    1234

    AUGUST 5, 2015

    N

    Controls database to create the tables above and insert the records.

    CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),

    doc_no VARCHAR2 (80), boe_dt DATE );

    INSERT EN stock_table

       VALUES ('I1', 'B1', '', '', '');

    INSERT EN stock_table

       VALUES ('I1', '', '', '', '');

    INSERT IN stock_table

       VALUES ('I2', '', '', '', '');

    INSERT EN stock_table

       VALUES ('I3', 'B70', '', '', '');

    INSERT EN stock_table

       VALUES ('I4', 'B80', '', '', '');

    INSERT EN stock_table

       VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');

    INSERT EN stock_table

       VALUES ('I6', 'B100', '', '', '');

    SELECT *

    FROM stock_table




     

    CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),

    doc_no VARCHAR2 (80), updt_dt DATE );

    INSERT IN history_table

       VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');

    INSERT IN history_table

       VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');

    INSERT IN history_table

       VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');

    INSERT IN history_table

       VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');

    SELECT *

    FROM history_table




     

    CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));


    INSERT INTO transaction1

       VALUES ('T1', 'IN');


    INSERT INTO transaction1

       VALUES ('T20', 'OUT');

    INSERT INTO transaction1

       VALUES ('T30', 'ALL');

    INSERT INTO transaction1

       VALUES ('T40', 'ALL');

    INSERT INTO transaction1

       VALUES ('T50', 'IN');

    INSERT INTO transaction1

       VALUES ('T60', 'ALL');

    INSERT INTO transaction1

       VALUES ('T70', 'ALL');

    INSERT INTO transaction1

       VALUES ('T80', 'IN');

    INSERT INTO transaction1

       VALUES ('T90', 'IN');

    SELECT *

    FROM transaction1




     

    CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),

    doc_no VARCHAR2 (80), doc_dt DATE );

    CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),

    doc_no VARCHAR2 (80), doc_dt DATE );

    CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),

    doc_no VARCHAR2 (80), doc_dt DATE );

     

    INSERT IN in_table_head_1

       VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');

    INSERT IN in_table_head_1

       VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');

    INSERT IN in_table_head_2

       VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');

    INSERT IN in_table_head_2

       VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');

    INSERT IN in_table_head_3

       VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');

    INSERT IN in_table_head_3

       VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');

    INSERT IN in_table_head_3

       VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');

    INSERT IN in_table_head_3

       VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');




     

    CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,

    h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));

    CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,

    h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));

    CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,

    h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),

    bat_no VARCHAR2 (80));

     

    INSERT IN in_table_item_1

       VALUES ('I1ID1', 'H1ID1', 'I1');

    INSERT IN in_table_item_1

       VALUES ('I1ID2', 'H1ID1', 'I100');

    INSERT IN in_table_item_1

       VALUES ('I1ID3', 'H1ID2', 'I3');

    INSERT IN in_table_item_2

       VALUES ('I2ID1', 'H2ID1', 'I1');

    INSERT IN in_table_item_2

       VALUES ('I2ID2', 'H2ID1', 'I200');

    INSERT IN in_table_item_2

       VALUES ('I2ID3', 'H2ID2', 'I2');

    INSERT IN in_table_item_3

       VALUES ('I3ID1', 'H3ID1', 'I2','B50');

    INSERT IN in_table_item_3

       VALUES ('I3ID2', 'H3ID2', 'I4','B40');

    INSERT IN in_table_item_3

       VALUES ('I3ID3', 'H3ID3', 'I4','');

    INSERT IN in_table_item_3

       VALUES ('I3ID4', 'H3ID4', 'I6','');

    SELECT *

    FROM in_table_item_1

    SELECT *

    FROM in_table_item_2

    SELECT *

    FROM in_table_item_3




     

    CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,

    txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));

    CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,

    i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));

     

    INSERT IN in_table_batch_1

       VALUES ('B1ID1', 'T1', '1234', 'B1');

    INSERT IN in_table_batch_1

       VALUES ('B1ID2', 'T70', '1234', 'B70');

    INSERT IN in_table_batch_2

       VALUES ('B2ID1', 'I2ID1', 'B30');

    INSERT IN in_table_batch_2

       VALUES ('B2ID2', 'I2ID2', 'B90');

    INSERT IN in_table_batch_2

       VALUES ('B2ID3', 'I2ID3', 'B60');

    Please advise a solution for the same.

    Thank you and best regards,

    Séverine Suresh

    very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)

    with

    case_1 as

    (select s.item_code,

    s.bat_no,

    h.txn_code,

    h.doc_no,

    h.updt_dt boe_dt,

    cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.

    cases where h.txn_code is not null

    and h.doc_no is not null

    and h.updt_dt is not null

    then 'case 1' '.

    end refers_to

    from (select item_code, bat_no, txn_code, doc_no, boe_dt

    of w_stock_table

    where bat_no is null

    or txn_code is null

    or doc_no is null

    or boe_dt is null

    ) s

    left outer join

    w_history_table h

    On s.item_code = h.item_code

    and s.bat_no = h.bat_no

    and exists (select null

    of w_transaction1

    where txn_code = nvl (s.txn_code, h.txn_code)

    and txn_type in ('IN', 'ALL')

    )

    ),

    case_2 as

    (select s.item_code,

    NVL (s.bat_no, h.bat_no) bat_no.

    NVL (s.txn_code, h.txn_code) txn_code.

    NVL (s.doc_no, h.doc_no) doc_no.

    NVL (s.boe_dt, h.updt_dt) updt_dt.

    cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.

    cases where h.txn_code is not null

    and h.doc_no is not null

    and h.updt_dt is not null

    then 'case 2'.

    end refers_to

    from (select item_code, bat_no, txn_code, doc_no, boe_dt

    of case_1

    where refers_to is null

    ) s

    left outer join

    w_history_table h

    On s.item_code = h.item_code

    and exists (select null

    of w_transaction1

    where txn_code = nvl (s.txn_code, h.txn_code)

    and txn_type in ('IN', 'ALL')

    )

    and not exists (select null

    of case_1

    where item_code = h.item_code

    and bat_no = h.bat_no

    and txn_code = h.txn_code

    and doc_no = h.doc_no

    and updt_dt = h.updt_dt

    )

    ),

    case_31 as

    (select s1.item_code,

    NVL (S1.bat_no, W1.bat_no) bat_no.

    NVL (S1.txn_code, W1.txn_code) txn_code.

    NVL (S1.doc_no, W1.doc_no) doc_no.

    NVL (S1.updt_dt, W1.doc_dt) updt_dt.

    cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.

    cases where w1.txn_code is not null

    and w1.doc_no is not null

    and w1.doc_dt is not null

    then "case 31'.

    end refers_to

    from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to

    of case_2

    where refers_to is null

    ) s1

    left outer join

    (select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no

    of w_in_table_item_1 i1

    inner join

    w_in_table_head_1 h1

    On i1.h1_sys_id = h1.h1_sys_id

    inner join

    w_in_table_batch_1 b1

    On h1.txn_code = b1.txn_code

    and h1.doc_no = b1.doc_no

    ) w1

    On s1.item_code = w1.item_code

    ),

    case_32 as

    (select s2.item_code,

    NVL (S2.bat_no, W2.bat_no) bat_no.

    NVL (S2.txn_code, W2.txn_code) txn_code.

    NVL (S2.doc_no, W2.doc_no) doc_no.

    NVL (S2.updt_dt, W2.doc_dt) updt_dt.

    cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.

    cases where w2.txn_code is not null

    and w2.doc_no is not null

    and w2.doc_dt is not null

    then "case 32'.

    end refers_to

    from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to

    of case_2

    where refers_to is null

    ) s2

    left outer join

    (select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no

    of w_in_table_item_2 i2

    inner join

    w_in_table_head_2 h2

    On i2.h2_sys_id = h2.h2_sys_id

    inner join

    w_in_table_batch_2 b2

    On i2.i2_sys_id = b2.i2_sys_id

    ) w2

    On s2.item_code = w2.item_code

    ),

    case_33 as

    (select s3.item_code,

    w3.bat_no,

    NVL (S3.txn_code, w3.txn_code) txn_code.

    NVL (S3.doc_no, w3.doc_no) doc_no.

    NVL (S3.updt_dt, w3.doc_dt) updt_dt.

    cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.

    cases where w3.txn_code is not null

    and w3.doc_no is not null

    and w3.doc_dt is not null

    then "case 33'.

    end refers_to

    from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to

    of case_2

    where refers_to is null

    ) s3

    left outer join

    (select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no

    of w_in_table_item_3 i3

    inner join

    w_in_table_head_3 h3

    On i3.h3_sys_id = h3.h3_sys_id

    ) w3

    On s3.item_code = w3.item_code

    )

    Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn

    of case_1

    where refers_to is not null

    Union of all the

    Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn

    of case_2

    where refers_to is not null

    Union of all the

    Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn

    from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,

    ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn

    from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn

    of case_31

    where refers_to is not null

    Union of all the

    Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn

    of case_32

    where refers_to is not null

    Union of all the

    Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn

    of case_33

    where refers_to is not null

    )

    )

    where rn = 1

    ITEM_CODE BAT_NO TXN_CODE DOC_NO BOE_DT BATCH_YN
    I1 B1 T1 1234 JANUARY 3, 2015 THERE
    I1 B30 T30 7890 FEBRUARY 5, 2015 N
    I2 B60 T60 1234 JANUARY 3, 2015 N
    I3 B70 T70 1234 FEBRUARY 1, 2015 THERE
    I4 - T90 1234 JANUARY 5, 2015 N
    I6 - T40 1234 AUGUST 5, 2015 N

    Concerning

    Etbin

  • PL Sql Query Builder Tool

    Hello

    Is there any Pl/Sql Query Builder tool / software that can make your life easier.

    best regards

    Sandy

    SPathak wrote:

    Hello

    I agree, that oracle Pl/Sql is powerful and gives a correct result.

    little time to create a complex query with assistant was looking for easy way.

    Sandy

    You will not learn using a GUI like TOAD tool (and I LOVE TOAD).  I always write by hand in the editor, instead of drag / drop regardless of what type of gui tool.  Only, I do not use the constructors unless you are a business analyst who has no experience of SQL.

  • SQL query to display the sum of the values of each June and December

    Hello having problems of construction of a query to the list SQL query to display the sum of the values of each June and December each year.

    My Table;

    TABLE name: MONTH_TERM

    Fields with values:

    TERM_KEYMONTH_ACTUALMONTH_DATE
    8250001/11/2015 0:00
    8245001/12/2015 0:00
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:00
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:00
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    What I would like to see in a query result:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/2015 0:00
    8245001/12/2015 0:00950
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:002525
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:002658
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    ---

    Here's my query:

    Select

    "TERM_KEY,"

    "MONTH_ACTUAL,"

    to_char(MONTH_DATE,'MM/YYYY') MONTH_DATE,

    DEAL to_char (MONTH_DATE, 'MM')

    WHEN '06' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 1 and 6

    AND term_key = 82)

    WHEN '12' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 7 and 12

    AND term_key = 82)

    ELSE null

    END as SIX_MO_CUMM,

    of MONTH_TERM

    where term_key = 82

    It's my results:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/15 0:00
    8245001/12/15 0:003608
    8240501/01/16 0:00
    8240001/02/16 0:00
    8245001/03/16 0:00
    8242501/04/16 0:00
    8243501/05/16 0:00
    8241001/06/16 0:003717
    8240901/07/16 0:00
    8241501/08/16 0:00
    8242001/09/16 0:00
    8242210/01/16 0:00
    8243601/11/16 0:00
    8255601/12/16 0:003608
    8256801/01/17 0:00
    8262401/02/17 0:00

    Any ideas on how to fix would be great

    Select term_key,

    month_actual,

    month_date,

    case mod (to_char (month_date, 'mm'), 6)

    When 0 then sum (month_actual)

    During)

    term_key partition

    order of month_date

    between the previous month '5' interval and the current line

    )

    end '6 MONTHS in TOTAL'

    from tbl

    order of term_key,

    month_date

    /

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 500 NOVEMBER 1ST, 15TH
    82 450 1 DECEMBER 15 950
    82 405 1 JANUARY 16
    82 400 1 FEBRUARY 16
    82 450 1ST MARCH 16
    82 425 1ST APRIL 16
    82 435 1 MAY 16
    82 410 2525 1 JUNE 16
    82 409 1 JULY 16
    82 415 1ST AUGUST 16
    82 420 16 - SEP - 01

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 422 1 OCTOBER 16
    82-436 NOVEMBER 1, 16
    82 556 2658 1 DECEMBER 16
    82 568 1 JANUARY 17
    82 624 1 FEBRUARY 17

    16 selected lines.

    SQL >

    SY.

  • SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate

    Hello

    SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate.

    Please help on this script and let me know if you need more details.

    ---

    You use a SELECT statement.  Let me know if you need more details.

  • Dependencies of object database by using the SQL query?

    Hi guys,.

    I just see the nice feature to discover the database object dependencies in the APEX (generator application-> app 123-> utilities-> database object dependencies).

    Is there a way to get this dependencies just with a SQL query? Also should I calculate a process in order to get the current dependencies? In APEX, you press a calculate button before you can see the dependencies.

    Thanks in advance and greetings from the Germany

    Steven

    After you import the app Builder application APEX 4500, I saw that the Start button the following process:

    wwv_flow_theme_manager.find_object_dependencies (p_flow_id =>: fb_flow_id, p_page_id-online null);

    In my example I can't use it, only the APEX_050000 user has privileges to use, and you must grant the privileges of your schema, so if you want to use it inside your application. My application must be independent of the schema and the specific database.

    Also it is not recommended to use this procedure because it is one of the procedures not supported that are only used by oracle.

Maybe you are looking for

  • Why is my friends and Podcasts for iOS 10 appear in my updates?

    I have iOS 9.3.2 on my iPhone and OS X.11.5 on my computer, using the latest version of iTunes (12.1.4.6) software and when I update my Apps in iTunes (under Apps-> updates) I see also find friends and Podcasts. If I try to update I tells me they re

  • Cannot transfer pictures to the external hard drive (refused)

    Hey! I can't transfer jpg on my computer to my external hard drive all of a sudden. He's worked a lot of years and now when I try to drag the photos on it gives me a stop sign, that white circle with the diagonal line through it. What gives? Any help

  • Problem connecting SQL toolkit Win7

    I use CVI 2013 and tto toolkit (2.2) of SQL to connect to a mySQL database.  I can connect to properly using my development computer, but not with the target.  Both computers are running 64-bit Windows 7 Professional (SP1).  I used to start the 64-bi

  • When I try to play a DVD, I get video but no sound.

    I HAVE WINDOWS XP SP3, I RECENTLY USED FIX IT IS A FUNCTION OF MEDIA PLAYER TO DETECT ANY PROBLEM. HE POINTED OUT THAT MY DVD DRIVE IS NOT DETECTED BY MEDIA PLAYER, EVEN IF IT IS LISTED IN THE DEVICE MANAGER AND WORK FINE ON OTHER MEDIA PLAYERS. I TR

  • BlackBerry Smartphones phone rings but I cannot hear caller on the other end

    I only had my phone for a few days and something went terribly wrong!  The phone seems to work fine until I downloaded the BlackBerry Handheld Software v4.5.0.152 (Multilingual) of late update last night. This morning I noticed by examining ringtones