Database Connectivity Toolkit (insert multi line)

Hi all. I recently got the toolkit of connectivity (DBCT) database on LabVIEW 2016 and I try to insert several rows in a database.

Using a sine signal input I tried to insert 50 rows in an iteration, but each method I tried returned 50 values in a line. The end of the constant of the line and table using chain worksheet, returned what looked like 50 lines, but when I questioned "SELECT COUNT (*) FROM... "the number of rows equals the number of iterations.

On another post on the forum, someone suggested that it is not possible to insert several lines using the DBCT. Can anyone confirm this?

I wrote a code that allows me to insert 3 rows in an iteration, under a single connection. However, this method is very time consuming and would not work for large amounts of data.

Can anyone think of a better way to do it?

Thanks in advance,

Lisa

Create your own query, and use the query execute VI.

Tags: NI Software

Similar Questions

  • Calling stored procedures with parameters with the database connectivity Toolkit

    Hi all

    I'm new to the forum and struggling to find a solution to a particular problem I have in this respect, using the LabVIEW Database Connectivity Toolkit on a project, I am currently working on my work.  I have a database in which I tables and stored procedures with parameters.  Some of these stored procedures have input, output and return parameters.

    I tried to follow this example, but to no avail: http://digital.ni.com/public.nsf/allkb/07FD130746083E0686257300006326C4?OpenDocument

    Such a stored procedure I am working on the implementation is named "dbo.getAllowablePNs", running "SELECT * from DeviceType" (DeviceType is the table).  In this case, it requires no input parameter, it has an output parameter that generates the table [cluster] and has a return parameter that returns an integer value (status code for execution) to show if an error occurred.  The DeviceType table has 3 columns; ID (PK, int not null), PN (nvarchar ((15), null) and NumMACAddresses (int, null).)  I have surpassed many examples and I talk to the support OR try to implement this and similar procedures stored in LabVIEW but have not been successful.  I am able to connect to the database with the VI of open connection without error, but spin in some confusion as a result of this step.  I then try to use the VI of parameter query create to call the stored procedure and set the parameters.  I guess I would then use the Set parameter value for each parameter that is connected to the entry of parameters on the previous query with parameters VI VI?  I am also having some confusion during and after these steps as well.  I would greatly appreciate advice or suggestions that anyone could have in this situation because I am not a SQL expert.  Also, I would be happy to provide more information that might be useful.

    Kind regards

    Jon

    Here's what I use to do this.  I think I had to change him create parameterized query VI for him to work.  There is a post on the forum about this somewhere.

  • Adding data to access DB with connectivity toolkit?

    I'm trying a new way to add data access instead of AciveX due to not knowing the commands necessary to interact with him.  Instead, I try to use the database connectivity toolkit and learn new techniques.  It is also an introduction to the variants that can ask me that question.

    Problem: Try to add data to multiple columns in the database in the same registration line.  I can add a data element to a fine column but cannot find out how to add data to multiple columns with different names.

    The approach I use is to open a new line and add the first element.  I then try to stay in the same record by using the thumb to the previous record vi but it isn't create one record for each item.  I'm sure this has to do with the way I'm configuration data tables and how to insert it vi data managing.

    The vi is attached.

    Thank you

    I don't have the data to test this, but I think you need to keep the data in a cluster, and then you should be able to add all columns at the same time without having to add each column at a time.

  • problem to generate an installation program for a project of database connectivity

    Hello

    I create a project using labview 2011, this project all simply select, edit and insert a file of access database by using the database connectivity Toolkit.

    There is no problem when I run this labview project, everything is perfect, but when I create a Setup program to run this project from another computer, I found something strange...

    the project do not insert or update the database, but it may choose the form, so I can say that the connection is good, so can any body tell me what is the problem.

    Help, please

    Thank you


  • Database connectivity Kit

    Hello

    I use the database connectivity toolkit to create a Microsoft access database.  I'm new to the Toolbox.  I've read the tutorials online and following the instructions.  I created an empty Microsoft Access file with an .mdb extension.  I also created a link to data .udl with tools > create data... in LabView and linked to the mdb file.  My code VI is attached.  I get the following error when I run the program (also attached).  I don't know what causes this error.  I appreciate your help.

    Thank you

    You can not create a table with the name "table".  It is a key word.

  • Reading large data using the database connectivity

    Hello

    I use the Labview database connectivity toolkit to connect to my database sqlitev3 (I'm using ODBC). I just have to connect to the database (using the block of open_connection) and read all the values inside (using the select_data block). The problem is that my database is huge (about 2 GB), and I get this error:

    . VI NI_Database_API.lvlib:Rec FETCH Recordset Data (R)-> NI_Database_API.lvlibB Tools Select Data.vi-> real_web.vi-> real_web.vi.ProxyCallerADO error: 0x8007000E Exception occurred in provider: not enough memory is available to complete this operation. in .vi NI_Database_API.lvlib:Rec Fetch Recordset Data (R)-> NI_Database_API.lvlibB Tools Select Data.vi-> real_web.vi-> real_web.vi.ProxyCaller

    What should I do? It seems that he reads the data in the memory and it doesn't have enough space for it. When I read the data I want to write to a file.

    Read it in pieces. Write each piece to the file, and then repeat with the next segment. Try to read and process all data in one shot is not very practical and you found out will not work.

  • How to send the SQL for SQL Server statement and return data without using database connectivity Kit?

    Hi, I tried to figure out how to extract data from my SQL Server databases and reading messages and to do some tests with examples, I can get data connection type in my SQL server, but so far nothing helps.  Is it possible to get data from a SQL Server database without using the database connectivity Toolkit?  and if so, how?  are there whitepapers and/or examples of this?  So far, I can't find something that works.  Thank you.

    Jesse - what is your reason for not using the database connectivity Toolkit? It is by far the best way to recover the data.

  • Problem installation database connectivity Kit

    My company manufactures in several factories around the world.  I have a problem in China and that you want to debug, and because the code is distributed in the form of exe, it is a problem.  My approach was to install a trial license of 30 days of LV2010 SP1, intend to withdraw when debugging is done.  So far, so good.  The problem is that the application requires the database connectivity Toolkit.  I downloaded a copy and tried to install.  It says it can't install because LV2010 is not installed.  Is it because of the eval license?

    If I wanted to rewrite hundreds of applications running, I could do that, but what I want is to install the DB Toolkit for a bit of troubleshooting.

    If NEITHER would alter the conditions on their license server, I would not have these problems.

  • multi line based on LOV table insert

    SEQ / / desc Ref number value of the option of lov to insert
    15DESC 1011
    16DESC 2022
    17033
    18044
    19055
    20.... 6067

    I have table, need multi line unique insert in process.there is a lov as values from 1 to 10 as number.when return value I select LOV (for example selected value 7) then the rows inserted in table 1 to 7 lines only.the table sequence number must increment as well use.

    Well, if your "seq by trigger" is a sequence number created via a trigger, then you don't need to add yourself as the trigger must do.

    You can then insert the number of rows you want, based on the input parameters...

    Suppose that your values in the apex are: OPT_NUMBER and: SL_NUMBER

    Insert into tablename (option_seq_num, sl_number)
    Select to_char(level,'fm09')
    ,: sl_number + (level-1)
    of the double
    connect by level<=>

    Example of the data...

    SQL > ed
    A written file afiedt.buf

    1 Select to_char(level,'fm09')
    2, & sl_number + (level-1)
    3 double
    4 * connect by level<=>
    SQL > /.
    Enter the value for sl_number: 0
    2 old:, & + sl_number (level-1)
    2 new:, 0 + (level-1)
    Enter the value of opt_number: 10
    4 old: connect by level<=>
    new 4: connect by level<=>

    TO_ 0 + (LEVEL-1)
    --- -----------
    01            0
    02            1
    03            2
    04            3
    05            4
    06            5
    07            6
    08            7
    09            8
    10            9

    10 selected lines.

  • Database connectivity broken vi Toolkit

    Hi all

    I upgraded from LV 8.5 to 8.6 (windows XP platform) a couple of weeks and have had no problems until today when all of sudden my vi toolkit database is coming from broken, with: "one or more of the inputs needed for this function are not wired or are wired incorrectly. Display the context-sensitive Help window to see what should be the connections to this function. ' Mistakes however is not the case on all my vi using the objects in the Toolbox.

    Measures taken so far without success:

    1 mass compilation of my vi

    2 mass compilation of database Toolbox

    3 re install Database Resource Kit

    4 mass compile the directory vi.lib

    5 in the old knowladge base article Document ID: 2RO7J544, assured the latest microsoft MDAC is installed.

    Any help is appreciated as we use this receptive toolkit.

    Thank you

    Chris

    PLATES

    Hi Chris,

    Thanks for the reply and I hope that your well.

    I need to try to understand something, when you say that the LabVIEW 8.6 upgrade have you improved the Toolbox?

    Toolkit LabVIEW Database Connectivity 1.0.2 is for LabVIEW 8.6. If, on the other hand your trying to use LabVIEW 8.6 with DC Toolkit 1.0.1 so I think that they are not officially compatible. However, these links may be of interest knowledge base: (after all, they are just screws). However, to say this - if you read the Readme for the new toolkit, that many things have changed for LabVIEW 8.6 - so becareful.

    You will have to manually copy all the files in one version of LabVIEW to another. Use the following instructions to achieve:

    1. Install the database connectivity toolset to the version of LabVIEW, say X.
    2. Copy the following files/directories in the directories right in the latest version of LabVIEW, say Y.
      • Copy the data directory from \LabVIEW X\vi.lib\addons\ to \LabVIEW Y\vi.lib\addons\
      • Copy the file database.llb \LabVIEW X\project\ to \LabVIEW Y\project\
      • Copy the data directory from \LabVIEW X\examples\ to \LabVIEW Y\examples\

    OR also check this,

    Installation of toolkits for use with several Versions of LabVIEW:

    http://digital.NI.com/public.nsf/allkb/58BE852CB35237C786256A290079DF39?OpenDocument

    Other questions that you may have encountered,

    Database connectivity tools claims are a polymorphic Subvi Broken

    http://digital.NI.com/public.nsf/allkb/0FA97221637E74CA86256C7C005069A5?OpenDocument

    "Update to the latest MDAC will solve this problem."

    I would also check that you have installed the Toolkit for LabVIEW 8.6 - toolkits are now specific for labVIEW 8.6. Then maybe try to reinstall and the Toolbox for LV8.6.

    Hope this helps and please let me know (Please specify a little more).

  • Insert new line in VO, engaging, and then call vo.executeQuery () does not display the newly created line.

    Hi guys

    I use jdev 12.1.2.

    I have a question about stale view object and entity data object.  My use case is: I have an af:table bound to data that I use to insert a new row in the database.  I create the line with a call from createWithParams, and everything works fine with it.  I call commit on the application module that contains the view object, and the data is correctly inserted in the database table.  Then, as part of my needs, I call vo.executeQuery () on the view object, however the newly inserted row is not present in the af: table or view object.  The line does not appear until I leave my application and return to it.  Once I do this, the line is in the object view and appears correctly in the table.

    It is not enough that I need the view object to be aware of the new line (s) without having to restart the application.  Y at - it a setting I am missing in my display object?  I guess my entity object contains stale data, but I don't know how to refresh its data.  Thanks for reading.

    Lance

    Hello

    you use a viewCriteria, so the value of this method of execution both (database and memory) in the Panel of viewCriteria

    try it once

    Thank you

  • Strange delay in database connections

    We are witnessing a strange delay when our JDBC client tries to make 4 connections to the database. The first connection takes 27 seconds (sometimes more) and 3 other connections are less than 1 second. As you can see in the ourJDBCclient log number 0 started at 09:09:11 connection request. He hit the listener at 09:09:11, and a strange gap of 27 seconds before ourJDBCclient reports a successful connect at 09:09:38 on the second line of the ourJDBCclient newspaper. In the source code, open connections are called right after the other. No idea where delay could come from?

    We run Oracle 11.2.3 EE server on Linux 2.6.18 - 92.el5

    Journal of ourJDBCclient:
    February 28, 2013 * 9:09:11 * AM paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: opening connection: jdbc:oracle:thin:@ourserver.ourdomain.com:1521:oursid, OURJDBCCLIENT
    February 28, 2013 * 9:09:38 * AM paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: successfully connected to the database (number 0 connection)
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: opening connection: jdbc:oracle:thin:@ourserver.ourdomain.com:1521:oursid, OURJDBCCLIENT
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: successfully connected to the database (connection number 1)
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: opening connection: jdbc:oracle:thin:@ourserver.ourdomain.com:1521:oursid, OURJDBCCLIENT
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: successfully connected to the database (number 2 connection)
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: opening connection: jdbc:oracle:thin:@ourserver.ourdomain.com:1521:oursid, OURJDBCCLIENT
    February 28, 2013 09:09:38 paradigm.ems.dbobjects.implementations.JDBC.DBObjectConnectionHandler openConnection FINE: successfully connected to the database (number 3)

    Listener.log:
    February 28, 2013 * 09:09:11 * (CONNECT_DATA = (SID = oursid) (CID = (= JDBC Thin Client PROGRAM) (HOST = __jdbc__) (USER = ourjdbcclientuser))) * (ADDRESS = (PROTOCOL = tcp (PORT = 56495))(HOST=10.0.10.1)) * establish * oursid * 0
    February 28, 2013 09:09:13 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = qa001.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 47848))(HOST=10.0.10.34)) * establish * othersid1.ourserver.ourdomain.com * 0
    February 28, 2013 09:09:16 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = ourserver.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 38159))(HOST=10.0.10.35)) * establish * othersid1.ourserver.ourdomain.com * 0
    February 28, 2013 09:09:22 * service_update * othersid1 * 0
    February 28, 2013 09:09:32 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = ourserver.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 38165))(HOST=10.0.10.35)) * establish * othersid1.ourserver.ourdomain.com * 0
    February 28, 2013 09:09:37 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = ourserver.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 38166))(HOST=10.0.10.35)) * establish * othersid1.ourserver.ourdomain.com * 0
    February 28, 2013 * 09:09:38 * (CONNECT_DATA = (SID = oursid) (CID = (= JDBC Thin Client PROGRAM) (HOST = __jdbc__) (USER = ourjdbcclientuser))) * (ADDRESS = (PROTOCOL = tcp (PORT = 56496))(HOST=10.0.10.1)) * establish * oursid * 0
    February 28, 2013 * 09:09:38 * (CONNECT_DATA = (SID = oursid) (CID = (= JDBC Thin Client PROGRAM) (HOST = __jdbc__) (USER = ourjdbcclientuser))) * (ADDRESS = (PROTOCOL = tcp (PORT = 56497))(HOST=10.0.10.1)) * establish * oursid * 0
    February 28, 2013 * 09:09:38 * (CONNECT_DATA = (SID = oursid) (CID = (= JDBC Thin Client PROGRAM) (HOST = __jdbc__) (USER = ourjdbcclientuser))) * (ADDRESS = (PROTOCOL = tcp (PORT = 56498))(HOST=10.0.10.1)) * establish * oursid * 0
    February 28, 2013 09:09:40 * service_update * othersid1 * 0
    February 28, 2013 09:09:40 * service_update * othersid1 * 0
    February 28, 2013 09:09:42 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = ourserver.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 38169))(HOST=10.0.10.35)) * establish * othersid1.ourserver.ourdomain.com * 0
    February 28, 2013 09:09:47 * (CONNECT_DATA = (SERVICE_NAME = othersid1.ourserver.ourdomain.com) (INSTANCE_NAME = othersid1) (CID = (PROGRAM = oracle) (HOST = ourserver.ourdomain.com)(USER=oracle))) * (ADDRESS = (PROTOCOL = tcp (PORT = 38170))(HOST=10.0.10.35)) * establish * othersid1.ourserver.ourdomain.com * 0

    Note that you referred, stipulates however a fix in 11.2.0.3 - so perhaps Oracle has of a workaround in this version? Or a better way to do what to do.

    This score gave strace results where socket connect() calls are made to (DNS?) IP addresses on port tcp 53 (DNS service port). That seems to be the problem... However, the note provides more technical details.

    And seeing that 11.2 is widely used and not widely, this occurs, it means something different in your installation and/or the environment.

    It would also be that this note has nothing to do with the question that you have, apart from sharing similar symptoms.

    I'd still go to isolate the error using SQL * more than the client (with debugging SQL * Net tracing on). Once the error can be triggered reliably somehow, then I turn on the SQL Server side * Net / debug tracing listener and resort to using commands like lsof and strace.

    You can also file an SR with Oracle support and let them provide you with clear instructions of what to do in order to provide useful diagnostics to solve the problem.

  • I can actually achieve with database connections?

    This may seem like a strange question, but once I set a MySQL connection in Dreamweaver, which actually do with it? Let me clarify what I do:

    I just discovered that we can define the MySQL connections when a PHP/MySQL site is defined. I'm used to manage my databases via MySequel or phpMyAdmin. To access the databases in rock Dreamweaver!

    So now I have a connection, I can read all my paintings... but I can't do anything with them. I can't add data, I can't change the data - all I can do is look at what is already there. I can click on the 'embed code' or the 'Show data' option, but they do not seem to do something useful: the first glue option only what is highlighted in my code, and the second brings up a window that displays data.

    What Miss me? Can I change the data somehow and just could not find the option yet? Or what else can I use my database for?

    For example, export or import data, synchronization with another host of database/database, etc.?

    Database connections are used to develop the data by web sites. So, if you are familiar with the side server script you can write code to make your site dynamic. In the past, DW had server behaviors which has simplified the process of creating web forms and displays for insert, update and select database tables, but these have been deleted because the code was never quite up to standards in force.

  • Insert several lines with dynamic data

    Hello
    When I do an insert into a table that has several lines of dynamic information. on
    a page, it inserts all rows that are dynamically filled. I want only what he
    to insert the lines that I choose the initials on. How can I do? Let's say I
    have 5 items that are displayed on a page and I want to insert only original
    the first 2 because the last 3 are left blank, how should I do this? I tried
    implementation of an if statement that says:

    < cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".

    Then make the insertion in the table

    < cfelse >
    < / cfif >

    I have this game were also up in a loop that says:

    < cfloop index = "help" list = "" #form.listofids # "delimiters =",">"

    Here is the code for just the insertion. I also have a code here
    Update another table. I got this to work, so I just try to get the insertion
    works fine for the moment. I can not use this where the query statement:
    Where ItemID = #id # because I'm trying to insert into the table of approval, not
    the items table. The table is just updated with some other info. in
    a few other input boxes.

    < cfloop index = "help" list = "" #form.listofids # "delimiters =",">"
    < cfif "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".

    < cfquery Datasource = '#application. DataSource #">"
    Insert into accreditation (APV_ItemID,
    APV_ECID,
    Document_Type,
    Approval_Initials)

    Values (' #Evaluate ("form.) (' ItemID # help # ") #',
    ' #Evaluate ("form. ("ECID # help #") #',
    < cfif isDefined (form '. ') ("Help of # PNR_Doc_Type # ') and
    "form. "Help of # PNR_Doc_Type #" NEQ "" > "".
    ' #Evaluate ("form. ("Help of # PNR_Doc_Type # ') #',
    < cfelse >
    NULL,
    < / cfif >

    < cfif isDefined (form '. ') ("Help of # PNR_Approval_Initials # ') and
    "form. "Help of # PNR_Approval_Initials #" NEQ "" > "".
    ' #Evaluate ("form. (Aide de # PNR_Approval_Initials #») #
    < cfelse >
    Null value
    (< / cfif >)

    < / cfquery >

    < / cfif >
    < / cfloop >

    On the page display, just a table of dynamic info. Here are the 4
    things that I have on this page that needs to be inserted to the database.

    < input type = "hidden" name = "' ECID #ItemID #" value = "#ECID #" > "
    < input type = "hidden" name = "' ItemID #ItemID #" value = "#ItemID #" > "
    < input type = "hidden" name = "" PNR_Doc_Type #ItemID # ' value = "PNR Req" > "

    < td align = "center" >
    < cfif Approval_Initials is not "" > "".
    #Approval_Initials #.
    < cfelse >

    < select name = "PNR_Approval_Initials #ItemID #" >
    < option value = "" > select initials < / option >
    < cfloop query = "ShowInitials" >
    < Cfif Engineer_Initials EQ 1 >
    < option value = "#Initials #" > #Initials # < / option >
    < / cfif >
    < / cfloop >
    < / select >

    < / cfif >
    < table >

    Can someone help me please on just the insertion in the database so that it
    will insert on the lines that I chose the initials on and not others? Thank you.

    Andy

    You almost managed, but I see that you have commented.

    (" The help of # PNR_Approval_Initials # ') AND form ["PNR_Approval_Initials # help #" ""] NEQ "" >

    Do things here

  • Multi lines convert to a single line

    Dear Group members
    I want to convert the queries that return multiple lines in a single line. Scanario is provided for in
    select * from inout v
    where v.empcode = '00047'
    and v. dated = '27-dec-09'
    
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     27/12/2009     0     0       G             1
    00047     27/12/2009     0     0       R             1
    00047     27/12/2009     7.44     483       P             1
    This query gives multi lines, but I would like to convert it into a line like this
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     27/12/2009     7.44     483       R             1
    If the employee came the day that has three traffic status ('G', 'R', 'P'), then it should show in_time, net_time situation and their participation should be 'R '.

    In this example there are two rows. I need the line that has in_time > 0, which is the 2nd bet replaces att_status 'P' for 'R '.
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     25/12/2009     0     0       R             1
    00047     25/12/2009     7.59     476       P             1
    Suppose that there are the 25/12/2009 and employee came that day then it shows the following result.
    EMPCODE      DATED        IN_TIME   NET_TIME     ATT_STATUS     VAL
    00047     25/12/2009     7.59     476       R             1
    It presents 'R' Att_status coloums instead of 'P '.

    >
    Note that
    'G' = blew in gusts
    'R' = rest
    "P" = present
    >

    Test case is provided for in
    CREATE TABLE INOUT
    (
      EMPCODE     VARCHAR2(10),
      DATED       DATE,
      IN_TIME     NUMBER(10,2),
      NET_TIME    NUMBER(10,2),
      ATT_STATUS  VARCHAR2(5),
      VAL         NUMBER(3)
    )
    
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','25-DEC-2009',     0    ,       0     ,   'R' ,           1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','25-DEC-2009',     7.59 ,       476   ,   'P' ,           1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009', 0    ,    0         ,   'G'     ,       1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009',     0    ,       0     ,       'R'     ,       1);
    insert into inout(EMPCODE,    DATED     ,IN_TIME , NET_TIME, ATT_STATUS, VAL  )
    values           ('00047','27-DEC-2009',     7.44 ,       483   ,       'P' ,           1);
    Thanks and greetings
    select distinct empcode,dated,
           case when cnt>0 then
             max(in_time) over (partition by empcode,dated)
            else
               in_time
            end in_time,
           case when cnt>0 then
             max(net_time) over (partition by empcode,dated)
            else
               net_time
            end net_time,
    
           case when cnt >0 then
               case when status in  ('G','P','R')  then
                'R'
                    when status in ('HCP','1/2') THEN
                'HCP'
               end
             else
               status
            end status
           from (
            select v.empcode,v.dated,v.in_time,v.net_time,(count(*) over (partition by v.empcode,v.dated)) cnt,att_status status
             from inout v
            where v.empcode = '00047')
    

    Published by: Khaled Aradhye, January 20, 2010 02:23

Maybe you are looking for