Load rows with date fileds include time

Hi, I need to load rows with SQLLoader. The data has am field with date and time but using mask don4t load the time, only date. How do I load date and time?
Thanks...

The following should work to load both the date and time (as long as it is not rejected for some reason)date_cancel date "YYYY/MM/DD HH24:MI:SS"To display the date and time after it has been loaded, you will have to use on of the following:ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH:MI:SS AM';
or
SELECT to_char(<column_name,'DD-MON-YYYY HH:MI:SS AM') from <table_name>;

Similar Messages

  • 30EA1: Database mounted, can't get rows with DATEs

    I'm starting to use SQL Developer 3.0.02 build MAIN-02.37. I tried to use it with a 10g standby database that is only mounted, to check on its recovery progress, and it appears to NOT return rows with DATE columns in them. I've tried this with both a TNS connection and a basic connection. If the database is open, no problem.
    Example: select instance_name, host_name, startup_time from v$instance;
    If I remove the DATE column "startup_time" from the query, I get the expected rows. The Logging Page pane at the bottom shows ORA-01219 errors "database not open, queries allowed on fixed tables/views only."
    I get that ORA-01219 message in TOAD against the mounted standby database, but I also get all the rows including the DATE column when I run the exact same statement there.
    Is this a bug, or expected behaviour, or is there some setting I'm missing?
    Edited by: gmaccrim on Nov 25, 2010 4:26 PM

    I have similar problem on standby database with query on v$database.
    This query
    SELECT name,dbid FROM V$database
    works fine, but this one
    SELECT name,dbid,created FROM V$database
    doesn't return any row.
    I have Version 2.1.1.64 Build MAIN-64.45.

  • How to write one row of data at a time to "Write to File"

    I am trying to write 10 parameters to the LV "Write to File". This is for just one row at a time. This happens evertime I get a failure in my test routine. I am not quite sure how to accomplish this task. If I get another failure I write one row again. I testing 4 DUTS at a time so I write this row of data to each file. I am sure it is very simple.
    Thanks
    Philip

    Assuming your 10 parameters are an numeric array with 10 elements,  use "write to spreadsheet" file with append set to true. (... and if they are scalars, built the array first ).
    LabVIEW Champion . Do more with less code and in less time .

  • Merge 2 rows into single row with data update?

    hello all,
    i have a table with below data,
    declare @tbl table (uid int, uname varchar(10), start_dt date, end_dt date)
    insert into @tbl values (1, 'env1', '4/4/2010', '5/5/2012')
    insert into @tbl values (2, 'env2', '5/4/2010', '6/6/2012')
    --earlier start data is '4/4/2010' from 'env1'
    --latest end data is '6/6/2012' from 'env2'
    insert into @tbl values (3, 'env1', '3/3/2010', '4/4/2012')
    insert into @tbl values (4, 'env2', '2/2/2010', '5/5/2012')
    --earlier start data is '2/2/2010' from 'env2'
    --latest end data is '5/5/2012' from 'env2'
    insert into @tbl values (5, 'env1', '8/8/2010', '12/12/2012')
    insert into @tbl values (6, 'env2', '9/9/2010', '10/10/2012')
    --earlier start data is '8/8/2010' from 'env1'
    --latest end data is '12/12/2012' from 'env1'insert into @tbl values (6, 'envX', '9/9/2010', '10/10/2012')insert into @tbl values (6, 'envY', '9/9/2010', '10/10/2012')
    i need to merge 2 rows for column  "uname" having value "env1" & "env2" to "envZ" and need to capture earlier start date and latest end date from both and update with new.
    the desire output should be,
    declare @tbl table (uid int, uname varchar(10), start_dt date, end_dt date)
    insert into @tbl values (1, 'envZ', '4/4/2010', '6/6/2012')
    insert into @tbl values (4, 'envZ', '2/2/2010', '5/5/2012')
    insert into @tbl values (5, 'envZ', '8/8/2010', '12/12/2012')
    insert into @tbl values (6, 'envX', '9/9/2010', '10/10/2012')
    insert into @tbl values (6, 'envY', '9/9/2010', '10/10/2012')
    note - i must need to update one row and delete other row as i can't insert new rows (having huge data with other columns also).
    please suggest optimize query. thanks!

    Which version and edition of SQL Server are you using?
    Whenever there is a row with 'env1', there is a corresponding 'env2' and vice versa? 
    The row with 'env2' is always after the row with 'env1'?   (uid+1)
    If the answers are yes to both questions above, here's a possibility:
    -- code #1 v3
    ;with
    ENVZ as (
    SELECT uid= case when T1.start_dt <= T2.start_dt then T1.uid else T2.uid end,
    start_dt= case when T1.start_dt <= T2.start_dt then T1.start_dt else T2.start_dt end,
    end_dt= case when T1.end_dt > T2.end_dt then T1.end_dt else T2.end_dt end
    from @tbl as T1
    inner join @tbl as T2 on T2.uid=T1.uid+1 and T2.uname='env2'
    where T1.uname = 'env1'
    MERGE
    into @tbl as T3
    using ENVZ as T4
    on T3.uid = T4.uid
    when matched and (T3.uname in ('env1','env2')) then
    UPDATE set T3.uname= 'envZ',
    T3.start_dt= T4.start_dt,
    T3.end_dt= T4.end_dt
    when not matched by source and (T3.uname in ('env1','env2')) then
    DELETE;
    The table @tbl is read three times in the above code. There are probably ways to optimize the above code. Or even other more efficient approach.
    José Diz     Belo Horizonte, MG - Brasil

  • Query to return separate rows for date range including NULLs

    I'm trying to write a query that will return all customers from table 1. Table 1 also provides a start date and an end date that may be different for different customers. Left join with Table 2  provides all matches and NULL if NO matches.
    If there is any match at all, I do not get the NULLs for other dates. There should be a match for each date from start to end. How can I write the code so that my return will loop thru each date and provide the match or NULL?

    Sorry. I am somewhat new to this and am not sure what you are requesting. I receive a return of all customers with the code below but if customer 1 has a start date of 1/1/15 and a stop date of 1/5/15 and a document exists for 1/1/15 and 1/3/15
    I do not receive the rows with NUL for 1/2/15, 1/4/15, and 1/5/15 which is what I'm trying to accomplish. If there is no match at all, I only receive the one row with NULL and I would like to see a row for each date from start to stop.
    SELECT  T1.IDNumber,T1.StartDate,T1.StopDate,T3.SignDateTime
    FROM
    Table1 T1
    INNER
    JOIN Table2
    T2
    ON
    T1.CustID
    = T2.CustID
    LEFT
    JOIN Table3
    T3
    ON
    T1.CustID
    = T3.CustID
    WHERE
    T1.StartDate
    > '2015-01-20 00:00:00.000'
    AND
    (T3.ReportID
    IN ('DOC1',
    'DOC2',
    'DOC3') OR
    T3.ReportID
    IS NULL)
    AND
    T2.YesNo
    = 'Y'

  • Sql loader error with date format

    Hi everyone,
    I have table and have a data in one coulmn RECORDED_DATE like '20090224' and my client is asking me to load this coulmn data in 'yyyymmdd' format.I am strucked up with my ideas.I used to_date('20090124','yyyymmdd') in control file.but it is also not working Here it is my control file
    LOAD DATA
    INFILE 'C:\xxxx\SQLLDR\HE data\HE_data_Feb.txt'
    BADFILE 'C:\xxxx\SQLLDR\HE data.bad'
    DISCARDFILE 'C:\xxxx\SQLLDR\HE data.dsc'
    INTO TABLE LSCCMGR.FASTPAY_HE_DATA
    REPLACE
    fields terminated by X'09'
    TRAILING NULLCOLS
    (RECORDED_DATE "TO_DATE(:RECORDED_DATE,'mm/dd/yyyy')"
    AGENT_ID
    MEASURE
    TRANSACTIONS
    FEES
    If i excute like this i am getting the error like
    Record 1: Rejected - Error on table LSCCMGR.FASTPAY_HE_DATA, column RECORDED_DATE.
    ORA-01843: not a valid month
    Getting for all records,what i need o change to get the RECORDED_DATE as dateformat.Ple any one help me in this issue to resolve
    How can we perform this using sql loader pls let me know,Thanks in advance.
    Sravan

    Hi,
    &gt;&gt;(RECORDED_DATE "TO_DATE(:RECORDED_DATE,'mm/dd/yyyy')"
    *Change this line to*
    (RECORDED_DATE "TO_DATE(:RECORDED_DATE,'yyyymmdd')"Regards,

  • Load Grid with data from System.Data.DataTable

    Hi all.
    A have a System.Data.DataTable e need load a grid with data from this DataTable.
    How Load a Grid with data from System.Data.DataTable?

    Hi Francisco,
    actually i don't think that you can use a .NET datatable to fill a business one grid.
    the business one has it's own datatable.
    in c# it would look like this:
    oForm.DataSources.DataTables.Add("MyDataTable");
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).DataTable = oForm.DataSources.DataTables.Item("MyDataTable");
    oForm.DataSources.DataTables.Item(0).ExecuteQuery("SELECT Field FROM [dbname].dbo.TABLE");
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).CollapseLevel = 1;
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).AutoResizeColumns();
    ((SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific)).SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Single;
    good night
    lg David

  • How to maintain dynamic rows with data when click on Previous button?

    Hi,
    I have 1 aspx page and divided into 3 pages using panels.Each panel has "Next" and Previous buttons
    I have created and deleted dynamic table rows when click on Add button using javascript. whenever i click on Next button it will navigate to same page of next panel.
    when i click on previous button then it goes to previous panel but whatever i have added dynamic table rows in 1st panel that got removed.
    Can u please help me for how to maintain state of dynamic table rows with entered data when click on Previous button?
    How to get dynamic table rows with entered data in previous panel when click on Previous button?
    Please find the below javascript code:
    function insertRow() {
    if (index >= 2) {
    document.getElementById('deleteRow').style.display = "inline";
    else { document.getElementById('DeleteRow').style.display = "none"; }
    var table = document.getElementById("myTable");
    var row = table.insertRow(table.rows.length);
    cell1 = row.insertCell(0);
    t1 = document.createElement("select");
    t1.options[t1.options.length] = new Option('--Select--', '0');
    t1.id = "ddlYear" + index;
    cell1.appendChild(t1);
    for (var i = 1975; i <= 2015; i++) {
    opt = document.createElement("option");
    opt.value = i;
    opt.text = i;
    t1.add(opt);
    t1.style.width = "155px";
    var cell2 = row.insertCell(1);
    t2 = document.createElement("Select");
    t2.options[t2.options.length]=new Option('--Select--','0');
    t2.options[t2.options.length]=new Option('State Board','1');
    t2.options[t2.options.length]=new Option('CBSE','2');
    t2.options[t2.options.length]=new Option('ICSE','3');
    t2.options[t2.options.length] = new Option('Others', '4');
    t2.style.width = "155px";
    t2.id = "ddlCourse" + index;
    cell2.appendChild(t2);
    var cell3 = row.insertCell(2);
    t3 = document.createElement("input");
    t3.id = "txtCity" + index;
    cell3.appendChild(t3);
    var cell4 = row.insertCell(3);
    t4 = document.createElement("input");
    t4.id = "txtInstitute" + index;
    cell4.appendChild(t4);
    var cell5 = row.insertCell(4);
    t5 = document.createElement("Select");
    t5.options[t5.options.length] = new Option('--Select--', '0');
    t5.options[t5.options.length] = new Option('English', '1');
    t5.options[t5.options.length] = new Option('Hindi', '2');
    t5.options[t5.options.length] = new Option('Telugu', '3');
    t5.options[t5.options.length] = new Option('Others', '4');
    t5.style.width = "155px";
    t5.id = "ddlMedium" + index;
    cell5.appendChild(t5);
    var cell6 = row.insertCell(5);
    t6 = document.createElement("input");
    t6.id = "txtSpecialization" + index;
    cell6.appendChild(t6);
    var cell7 = row.insertCell(6);
    t7 = document.createElement("input");
    t7.id = "txtFnl" + index;
    cell7.appendChild(t7);
    index++;
    function DeleteRow(index) {
    var table = document.getElementById("myTable");
    table.deleteRow(index);
    // if (index = 2) { alert("There is no rows added.Please add the new row"); }
    Design:
    <tr style="font-size: 12pt" id="trSecond" runat="server">
    <td colspan="3">
    <table id="myTable" width="100%" border="0">
    </table>
    <tr>
    <td colspan="3" align="right">
    <input type="button" title="Add" value="Add" onclick="insertRow();" />
    <input type="button" id="deleteRow" title="Delete" value="Delete Row" onclick="DeleteRow(this);" style="display:none" />
    </td>
    </tr>
    Thank you.

    Put the button click into an action listener and build the new frame there. The code I have below isn't exactly what you're doing (it's amazingly oversimplified), but it's probably similar enough to get your wheels turning in the right direction.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    public class sample
         public static void main(String[] args)
              JFrame frame = new JFrame("Sample");
              frame.setSize(400,400);
              Container content = frame.getContentPane();
              content.setLayout(new FlowLayout());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              final JTextField text = new JTextField(10);
              content.add(text);
              JButton button = new JButton("Send");
              content.add(button);
              frame.setVisible(true);
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        JFrame myframe = new JFrame("Results");
                        myframe.setSize(200,200);
                        Container mycontent = myframe.getContentPane();
                        mycontent.setLayout(new FlowLayout());
                        String mytext = text.getText();
                        JLabel label = new JLabel();
                        label.setText(String.valueOf(mytext));
                        mycontent.add(label);
                        myframe.setVisible(true);
    }

  • SQL Loader Problem with Date Format

    Dear all,
    I am dealing with a problem in loading data with SQL Loader. The problem is in the date format.
    More specifically, I created the following Control File:
    file.ctl
    LOAD DATA
    INFILE 'D:\gbal\chatium.log'
    APPEND INTO TABLE CHAT_SL
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (SL1 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL2 char,
    SL3 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL4 char,
    SL5 char,
    SL6 char,
    SL7 char,
    SL8 char,
    SL9 char,
    SL10 char,
    SL11 char,
    SL12 char,
    SL13 char,
    SL14 char,
    SL15 char)
    The data we want to load are in the following file:
    Apr 29, 2007 12:05:49 AM 1060615 Apr 29, 2007 12:05:35 AM 306978537730 24026384 chatium.user.userinfo WAP 0
    Apr 29, 2007 12:12:51 AM 1061251 Apr 29, 2007 12:12:27 AM 306978537730 24026384 chatium.channel.list WAP 0
    Apr 29, 2007 12:12:51 AM 1061264 Apr 29, 2007 12:12:32 AM 306978537730 24026384 chatium.channel.listdetail WAP 0
    Apr 29, 2007 12:13:51 AM 1061321 Apr 29, 2007 12:13:31 AM 306978537730 24026384 chatium.user.search WAP 0
    Apr 29, 2007 12:13:51 AM 1061330 Apr 29, 2007 12:13:37 AM 306978537730 24026384 chatium.user.userinfo WAP 0
    The error log file is the following:
    SQL*Loader: Release 9.2.0.1.0 - Production on Mon Apr 30 11:29:16 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Control File: file.ctl
    Data File: D:\gbal\chatium.log
    Bad File: chatium.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table CHAT_SL, loaded from every logical record.
    Insert option in effect for this table: APPEND
    TRAILING NULLCOLS option in effect
    Column Name Position Len Term Encl Datatype
    SL1 FIRST * WHT DATE MonDD,YYYYHH:MI:SS
    SL2 NEXT * WHT CHARACTER
    SL3 NEXT * WHT CHARACTER
    SL4 NEXT * WHT CHARACTER
    SL5 NEXT * WHT CHARACTER
    SL6 NEXT * WHT CHARACTER
    SL7 NEXT * WHT CHARACTER
    SL8 NEXT * WHT CHARACTER
    SL9 NEXT * WHT CHARACTER
    SL10 NEXT * WHT CHARACTER
    SL11 NEXT * WHT CHARACTER
    SL12 NEXT * WHT CHARACTER
    SL13 NEXT * WHT CHARACTER
    SL14 NEXT * WHT CHARACTER
    SL15 NEXT * WHT CHARACTER
    Record 1: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 2: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 3: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    Record 4: Rejected - Error on table CHAT_SL, column SL1.
    ORA-01840: input value not long enough for date format
    I wonder if you could help me.
    Thank you very much in advance.
    Giorgos Baliotis

    SQL> select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual;
    select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS FF3AM') from dual
    ERROR at line 1:
    ORA-01821: date format not recognized
    SQL> ed
    Wrote file afiedt.buf
      1* select to_date('Apr 29, 2007 12:05:49 AM','Mon DD, YYYY HH:MI:SS AM') from dual
    SQL> /
    TO_DATE(
    29/04/07
    SQL> Then, you defined blank space as separator, but there is spaces in your date inside your file. So, you should add double-quotes around the date field like below, and add optionally enclosed by '"' into your ctlfile.
    "Apr 29, 2007 12:05:49 AM" 1060615 "Apr 29, 2007 12:05:35 AM" 306978537730 24026384 chatium.user.userinfo WAP 0
    "Apr 29, 2007 12:12:51 AM" 1061251 "Apr 29, 2007 12:12:27 AM" 306978537730 24026384 chatium.channel.list WAP 0
    "Apr 29, 2007 12:12:51 AM" 1061264 "Apr 29, 2007 12:12:32 AM" 306978537730 24026384 chatium.channel.listdetail WAP 0
    "Apr 29, 2007 12:13:51 AM" 1061321 "Apr 29, 2007 12:13:31 AM" 306978537730 24026384 chatium.user.search WAP 0
    "Apr 29, 2007 12:13:51 AM" 1061330 "Apr 29, 2007 12:13:37 AM" 306978537730 24026384 chatium.user.userinfo WAP 0Example :
    http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#sthref477
    Nicolas.

  • Database Refresh with (data + metadata including views, functions etc)

    PROBLEM:
    I want to refresh data + metadata (tables, views, function, procedures, packages, triggers, package body etc) from one database to another database.
    Now if objects already exists in the TARGET database, then we have option as TABLE_EXISTS_ACTION=REPLACE for TABLE.
    But, do we have any other such option for OBJECTS OTHER THAN TABLE (LIKE VIEWS, PROCEDURES, FUNCTION, TRIGGER, PACKAGE, PACKAGE BODY).?
    Because I dont see any such option. Currently if the Object is already there in the TARGET Database, it errors out without importing as OBJECT ALREADY EXISTS statement.
    As we have lots of migration, number of objects changes & new objects coming up in Production very frequently.
    And due to this, we cannot put big list of INCLUDE and also even keeping that we have to prepare that list very often as number of objects changes very frequently.
    Please help me with some better solution.
    Thanks to all participants in advance.
    Nil

    I understand that you are Newbie , let give me simple steps.
    Follow the steps on testing envi.
    1. Drop only Application users that you want to refresh from Prod(Do NOT drop users system,sysaux.. or tablespaces)
    2. Create the users that you dropped.
    3. using import or import data pump import the data.
    In case you want to import user"A" data to "B" use REMAP_SCHEMA option.
    See the below link for data pump export/import with examples.
    http://oracleracexpert.blogspot.com/2009/08/oracle-data-pump-exportimport.html
    Hope this helps.
    Regards,
    Satishbabu Gunukula
    http://oracleracexpert.blogspot.com
    Click here for [How to add and remove OCR|http://oracleracexpert.blogspot.com/2009/09/how-to-add-and-remove-ocr-oracle.html]
    Click here in [ Making decisions and migrating your databases |http://oracleracexpert.blogspot.com/2009/08/download-sql-developer-migration.html]
    Click here to lean [ Static parameters change in SPFILE and PFILE|http://oracleracexpert.blogspot.com/2009/09/how-to-change-static-parameters-in.html]
    Edited by: Satishbabu Gunukula on Sep 14, 2009 5:09 PM
    Edited by: Satishbabu Gunukula on Sep 18, 2009 10:35 AM

  • Update multiple rows with datas from the same table

    i have a table like
    name version value1 value2
    2 A 4,31 3,5
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    so name + version is unique
    i have to update the datas value1 and value2 ( version A) with the datas from version B where the name ( VersionA) = name version B
    i.e the result should be
    name version value1 value2
    2 A 6,97 12
    3 A 3,45 10
    2 B 6,97 12
    4 B 12 16
    is it possible to do this in sql? ( sql. 8.1)

    ... if your table does not contain exactly what you expect you could get:
    'single row sub-query returns more than one row'
    To prevent that, put a unique index on (name, version). If this combination is not always unique, you will need to cater for the possibility in the update statement.

  • Display row with date search ADF 11g 11.1.1.2.0

    Hi
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I'm want to display the table rows according to the date between search.
    My screen
    From ______ To ______ Seachbutton
    EMPNO EMPNAME JOINDATE
    001 JACK 04/05/2010
    002 JILL 02/05/2010
    003 PALIN 06/05/2010
    when i select date with adf input date in both text box and fire search . i want display the searched records/rows
    sorry ......
    thanks in advance
    Edited by: user9010551 on May 6, 2010 3:43 AM

    Hi
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I'm want to display the table rows according to the date between search.
    My screen
    From ______ To ______ Seachbutton
    EMPNO EMPNAME JOINDATE
    001 JACK 04/05/2010
    002 JILL 02/05/2010
    003 PALIN 06/05/2010
    when i select date with adf input date in both text box and fire search . i want display the searched records/rows
    sorry ......
    thanks in advance
    Edited by: user9010551 on May 6, 2010 3:43 AM

  • Procedure to insert a new row with data, but no PK

    Ok,
    I have an assignment to insert a row into an existing table and to insert values (via a procedure) into certain fields. However, none of the fields that are to be INSERTED upon are the PK field.
    I wrote the following for a start, and I get an error since I have NULL in the PK field. The PK is named PRODUCTID. I am only to insert p_name, p_description, p_imgname, p_cost, and p_status. I am in school now, and am a beginner at PL/SQL, and any help would be appreciated.
    How can I do this without assigning a value to the PK field?
    For reference: there are 10 rows in the table, and the one I'm inserting is row 11.
    CREATE OR REPLACE PROCEDURE prod_add_sp
       (p_name IN bb_product.productname%type,
        p_description IN bb_product.description%type,
        p_imgname IN bb_product.productimage%type,
        p_cost IN bb_product.price%type,
        p_status IN bb_product.active%type)
       IS
      BEGIN
        INSERT INTO bb_product (idproduct, productname, description, productimage, price, active)
         VALUES (lv_prodid_num, p_name, p_description, p_imgname, p_cost, p_status);
    END;
    /

    > Ok, since the table had 10 rows (PK was numbers 1-10, I added number 11 in the PK field for the
    corresponding row.
    Any other way to do this?
    You want to use a number generator to give you a unique number to use as PRODUCT_ID. Such a generator is known as a sequence in Oracle. Like your products table, it needs to be created up front.
    E.g.
    create sequence product_id_sequence start with 1 increment by 1 nocycle nomaxvalue;
    Note that several "copies" of this sequence can be active at the same time to serve a number of concurrent requests. In other words, instead of everyone to queue to get a number from the sequence generator, it creates for example 10 queues and is able to service 10 requests at the same time. This is great for scalability and not creating a bottleneck. At the same time, the numbers handed out are unique but not in a gap free ascending sequence either. Which is fine. Relational design says that we need a UNIQUE number for a surrogate key. Not a gap free ascending number range.
    Okay, in your INSERT statement you need to add the PK column and add the next sequence value into it, e.g.
    INSERT INTO products ( product_id, .... ) VALUES( product_id_sequence.nextval, ... );
    Refer to the documentation URLs posted above on sequences for more details.

  • Error loading init with data request in BW for 0mat_plnt

    Hi experts,
    I had a failed init request for 0mat_plant , I have deleted and run an inti request with a certain plant 0000-0001,
    the Init requests is showing me a warning "Was not able to determine company code or cost center for plant 0001".
    I have marked the request red and ran an init without data transfer (completed successfully ) , subsequently ran a full repiar request (is showing the same issue).
    I have checked in rsa3 (R/3) The datasource is picking up the correct data , and the transfer structure doesnt have the filed Company code , neither the Cost center.
    Please post you comments , that would be helpful.

    yes the update tab is flaged as " always update data, even if not master data exist  for the data.
    I have not been able to resolve the issue yet ,
    Has anyone faced this kind of issue, request to post your comments..
    Edited by: Abbriti on Mar 25, 2010 2:36 PM

  • Difference of last 2 Rows with Start and End Time

    Hi all,
      This question is an extention to the below question
    http://social.msdn.microsoft.com/Forums/en-US/ca938faf-49a7-4212-afd2-19046cbfcc8b/difference-of-last-2-rows?forum=transactsql
    I got the difference of last 2 rows from the above question. But now the table added with one field StartTime. The final table is
    CREATE TABLE MeterReading
    ReadingID int,
    MeterID int,
    DataCounter int,
    StartTime datetime,
    Value numeric(16,4)
    As per the my first thread i got the best answer like below
    SELECT MeterID, SUM(CASE WHEN Recency = 1 THEN Value ELSE -Value END)
    FROM (
    select DISTINCT MeterID, Value, DENSE_RANK() OVER (PARTITION BY MeterID ORDER BY StartTime DESC) 'Recency'
    from MeterReading
    ) x
    WHERE Recency IN (1,2)
    GROUP BY MeterID
    Now i need to add StartTime to the result. The expectation is, it will take the difference of last and second last record. So i need the starttime as secondlast record starttime and endtime as last record startime. Please help me

    I got a solution like below
    SELECT
    y.ProcessParameterID
    ,MIN(y.StartTime) StartTime
    ,MAX(y.EndTime) EndTime
    ,SUM(y.Value) Value
    FROM
    SELECT
    ProcessParameterID
    ,(CASE WHEN Recency = 2 THEN StartTime ELSE null END) StartTime
    ,(CASE WHEN Recency = 1 THEN StartTime ELSE null END) EndTime
    , SUM(CASE WHEN Recency = 1 THEN Value ELSE -Value END) Value
    FROM (
    select DISTINCT ProcessParameterID, StartTime, Value, DENSE_RANK() OVER (PARTITION BY ProcessParameterID ORDER BY StartTime DESC) 'Recency'
    from LT_LAEMI_HWT_Readings
    ) x
    WHERE Recency IN (1,2)
    GROUP BY ProcessParameterID
    , Recency
    , StartTime
    ) y
    GROUP BY ProcessParameterID
    Can you advice me, is this the correct way or any alternative short method

Maybe you are looking for

  • Error  While Saving a query

    Hi All, When I am trying to Save a query Its throwing me this error. "An unexpected 'object variable or with block variable not set' error occured in wdbrlog." Any pointers would be helpful. Regards, Mayank

  • Which iPhone 5C should I go for: 16GB or 32GB?

    Hello, I was wondering if it was possible to gain some advice and opinions on which memory size iPhone 5C is more suitable for my needs and is it worth getting the 32GB? On top of my contract, for £80 I can get the 16GB or for £140 I can get the 32GB

  • Can we write SQ01 query on bkpf vs faglflexa...

    Hi All, Is it possible to write an infoset to join two tables BKPF and FAGLFLEXA.. I have written an infoset for the same but when i execute the query it's not showing any data in the out put list.. can any one help me how to make this possible.. Tha

  • Best way to write this report

    I hope someone can help. I am fairly new to Oracle Reports. I need to compile a report with totals only. The problem is I need to pull the detail data in to perform fuctions on that detail data but I don't want to display the detail data, only the bo

  • Mapping a CASE constraint gives error:The expression is not properly formed

    Hi I am hoping someone can help us with this as we cannot find it in the usual places: I have the following WHERE clause in my query: WHERE xd.cii_owner_account_id = hca.cust_account_id AND incidentb.incident_status_id = incident_status.incident_stat