How can I validate a date using sql

How can I validate a date using sql or pl/sql
select to_date('01/01/2009','mm/dd/yyyy') from dual this is a good date
but how can I check for a bad date
select to_date('0a/01/2009','mm/dd/yyyy') from dual
Howard

William Robertson wrote:
It'll be complicated in pure SQL, as you'll have to parse out day, month and year and then validate the day against the month and year bearing in mind the rules for leap years. It would be simpler to write a PL/SQL function and call that.Nah, not that complicated, you just need to generate a calender to validate against.
SQL> ed
Wrote file afiedt.buf
  1  with yrs as (select rownum-1 as yr from dual connect by rownum <= 100)
  2      ,mnth as (select rownum as mn, case when rownum in (4,6,9,11) then 30
  3                            when rownum = 2 then 28
  4                       else 31
  5                       end as dy
  6                from dual
  7                connect by rownum <= 12)
  8      ,cent as (select (rownum-1) as cen from dual connect by rownum <= 21)
  9      ,cal as (select cen, yr, mn,
10                      case when ((yr = 0 and mod(cen,400) = 0)
11                             or (mod(yr,4) = 0 and yr > 0))
12                            and mn = 2 then dy+1
13                      else dy
14                      end as dy
15               from cent, yrs, mnth)
16  --
17      ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
18  --
19  select case when cal.cen is null then 'Invalid Date'
20              when not regexp_like(dt,'^[0-9]{1,2}[\/.-_][0-9]{1,2}[\/.-_][0-9]{4}$') then 'Invalid Date'
21         else dt
22         end as dt
23  from dt left outer join
24               cal on (to_number(regexp_substr(dt,'[0-9]+')) between 1 and cal.dy
25                   and to_number(regexp_substr(dt,'[0-9]+',1,2)) = cal.mn
26                   and floor(to_number(regexp_substr(dt,'[0-9]+',1,3))/100) = cal.cen
27*                  and to_number(substr(regexp_substr(dt,'[0-9]+',1,3),-2)) = cal.yr)
SQL> /
Enter value for date_dd_mm_yyyy: a1/02/2008
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select 'a1/02/2008' as dt from dual)
DT
Invalid Date
SQL> /
Enter value for date_dd_mm_yyyy: 01/02/2008
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '01/02/2008' as dt from dual)
DT
01/02/2008
SQL> /
Enter value for date_dd_mm_yyyy: 29/02/2008
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '29/02/2008' as dt from dual)
DT
29/02/2008
SQL> /
Enter value for date_dd_mm_yyyy: 30/02/2008
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '30/02/2008' as dt from dual)
DT
Invalid Date
SQL> /
Enter value for date_dd_mm_yyyy: 29/02/2009
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '29/02/2009' as dt from dual)
DT
Invalid Date
SQL> /
Enter value for date_dd_mm_yyyy: 28/02/2009
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '28/02/2009' as dt from dual)
DT
28/02/2009
SQL> /
Enter value for date_dd_mm_yyyy: 0a/01/2009
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '0a/01/2009' as dt from dual)
DT
Invalid Date
SQL> /
Enter value for date_dd_mm_yyyy: 00/01/2009
old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
new  17:     ,dt as (select '00/01/2009' as dt from dual)
DT
Invalid Date
SQL>

Similar Messages

  • How can we store xml data using jsp

    hai,
    Can anyone please explain in brief how to store xml data using jsp. Also if possible please explain by specifying the code.
    regards,
    Praveen Vinnakota.

    [email protected] wrote:
    how can we publish Labview data using the web?
    You could use shared variables and publish them to the network or use data sockets.
    Kudos always welcome for helpful posts

  • How can we publish Labview data using the web

    how can we publish Labview data using the web?
    Dr. Eugene Berman, Moran Kamilyan and Ravit Bar

    [email protected] wrote:
    how can we publish Labview data using the web?
    You could use shared variables and publish them to the network or use data sockets.
    Kudos always welcome for helpful posts

  • How can I validate a date field in Portal Forms

    I have a date field in portal forms that I want to perform validation on to make sure it's in the proper format before being accepted (mm/dd/yyyy). How can I validate against that field?

    Hi Ben,
    I took the time to test and revise. This is code that will validate a date entry (format MM/DD/YYYY). Just paste this in the "Before the start of the form..." window of the Additional PL/SQL code section of the form. Then add validateDate(); into the onBlur event window of the field in question. Replace the CYCLE_END_DATE with the field name in question.
    HTP.P('
    <SCRIPT LANGUAGE=javascript>
    function validateDate() {
    var ddObj;
    var mmObj;
    var yyObj;
    var day;
    var mon;
    var year;
    var field_val;
    var field_name;
    for (var j=0; j < document.forms[0].elements.length; j++) {
    field_name = document.forms[0].elements[j].name;
    field_val = document.forms[0].elements[j].value;
    if (field_name.substring(field_name.indexOf(''DEFAULT.'') + 8, field_name.lastIndexOf(''.01'')) == ''CYCLE_END_DATE'') {
    var delimPos = field_val.search(/\//i);
    if (delimPos < 0)
    alert(''Invalid date entry! Please enter in MM/DD/YYYY format. '' +
    ''e.g, Dec 21, 2003 would be entered as 12/21/2003'');
    else
    if (field_val.length != 10)
    alert(''Invalid date entry! Please Please enter in MM/DD/YYYY format. '' +
    ''e.g, Jan 1, 2003 would be entered as 01/01/2003'');
    else {
    month = field_val.substring(0, field_val.indexOf(''/''));
    day = field_val.substring(field_val.indexOf(''/'') + 1, field_val.lastIndexOf(''/''));
    year = field_val.substring(field_val.lastIndexOf(''/'') + 1, 10);
    /* Need to subtract 1 from value because in Javascript, January begins with 0
    and ends with 11 for December */
    month = month - 1;
    ddObj = new Date(year, month, day);
    mmObj = new Date(year, month, day);
    yyObj = new Date(year, month, day);
    if (ddObj.getDate(ddObj.setDate(day)) != day)
    alert(''Invalid day!'');
    if (mmObj.getMonth(mmObj.setMonth(month)) != month)
    alert(''Invalid month!'');
    if (mmObj.getYear(mmObj.setYear(year)) != year)
    alert(''Invalid year!'');
    </SCRIPT>
    ');

  • How can i validate the data in the control file?

    Consider that the SQLLoader reads the Input data File from the path and it loads the data into the tables based up on the descrition specified in the control File.
    First, the table to be filled is created:
    create table sql_loader_1 ( load_time date, field_1 Numeric, field_2 varchar2(10)
    Sample Control File :
    load_1.ctl
    load data
    infile 'load_1.dat' "str '\r\n'"
    insert into table sql_loader_1
    load_time sysdate,
    field_2 position( 1:10),
    field_1 position(11:20)
    Note that the positions 11 through 20 are loaded into field_1 and positions 1 through 10 into field_2. The field load_time is filled with the current time (sysdate) of the load.
    Here's the data. The name of the file (load_1.dat) had been specified with the infile statement in the control file.
    load_1.dat
    0123456789abcdefghij
    foo bar
    here comes a very long line
    and the next is
    short
    Here i want to validate the field_1 (Numeric Datatype) since the data file contains the character value (i.e)abcdefghij

    Good question for this forum:
    Export/Import/SQL Loader & External Tables
    Werner

  • How can I extract multine data using a regex? ... driving me nuts!!

    Hi everyone,
    I have a file which I'm interested in extracting information from. Here is a snippet:
    CGCNNNNGTAGTC
    TAGTCNN
    ... my goal is to create a regex which extracts out everything beyond the N (on the first line), along with anything on the next line which is not N.
    As a result, my desired outcome is "GTAGTCTAGTC"
    What I've worked on sofar (for my regex) is:
    Pattern p = Pattern.compile("(N[ATGC].*)\\r\\n[ATGC].*N", Pattern.MULTILINE);I've worked on it for sometime now, and am very interested in advice as-to how I can extract my desired information.
    Thanks once again,
    p.
    Edited by: phosse1 on Apr 9, 2009 8:37 PM
    Edited by: phosse1 on Apr 9, 2009 8:38 PM

    Till one of the regex gurus comes around to shorten the regex by 50% and increase the readability and efficiency by 1000% ;-)import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class CrossLineMatcher {
       public static void main(String[] args) {
          String[] inputs = {
             "CGCNNNNGTAGTC\n" +
             "TAGTCNN",
             "CGCNNNNGTAGTC\r\n" +
             "TAGTCNN",
             "CGCNNNNGTAGTC\r" +
             "TAGTCNN",
          String regex = "(?m)(?<=N)([^N]+)(?:$[\\r\\n]+^)([^N]+)(?=N)";
          Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
          for (String input : inputs) {
             Matcher matcher = pattern.matcher(input);
             while (matcher.find()) {
                System.out.println(matcher.group(1)+matcher.group(2));
          System.out.println("=======================");
          regex = "(?m).*?N([^N]+)(?:$[\\r\\n]+^)([^N]+)N.*?";
          for (String input : inputs) {
             System.out.println(input.replaceAll(regex, "$1$2"));
    everything beyond the N (on the first line), along with anything on the next line which is not NYou want to express a match for "anything that is not N", use [^N]
    [ATGC] means "anything that is A, T, G or C"
    db

  • How can I validate a signature using OCSP?

    I need to manage signed PDF documents. It was very easy to create a java prog to create and sign a PDF document (using itext).
    I use the certificate from my Belgium Identity card for signature. Fine.
    My problem is when reading the sign document.
    On most PC, I see the signature with a yellow question mark (identity of the signer is unknown) which is not fine.
    On some PC, when the signed document is opened, I see a real time connection to "http://ocsp.eid.belgiulm.be" and the signature appears with a green check which is very fine. That what I want.
    What 'and how) are the required configuration to force this OCSP check?
    I am using Adobe Reader 9 (v 9.4.1)
    Thanks

    The validation is currently done on both PC. That not the problem.
    But on the first one, the validation fails because the "Identity of the signer is unknown"
    On my second PC, the validation is done using OCSP (I see a realtime connection to "ocsp.eid.belgium.be") resulting in a successfull validation.
    I would like TO FORCE OCSP VALIDATION on both PC. But I have no idea on how to force this OCSP validation. By chance, it happens on the first PC but I do not know why?

  • How can I lock planning data using SEM-BPS Status tracking monitor

    Hi,
    What are the pre-requisites for being able to lock planning data when using certain header characteristics
    in customizing the Status and Tracking System in BPS ?
    I have done the following and expect the locks to be set, but they are not set and the data is still available for planning :
    1. Assigned the 0COMPANY hierarchy to a subplan with a planning area which has header characteristics : VERSION and CALYEAR.
    Header  characteristic customization is as follows :
    CALYEAR = 2005
    VERSION = V1
    2. Have set the status of all nodes in the hierarchy to 'approved' .
    3. I execute a Web planning interface for this planning area with a selection of a 0COMPANY within this hierarchy, PLANYEAR = 2006, CALYEAR = 2005 and expect the plan to be locked but its not.
    Could someone kindly explain why ?
    Regards.
    PS : Hope the scenario is clearly explained.

    Hello Anuradha,
    The plan data should be locked after the status is switched if
    - the package selection used in the planning function or planning layout is entirely contained in the header selection
    - you do not access the plan data via a multi area
    - the user does not have the authorization "STS_SUP" (super user).
    It is important to note that the characteristic used to define the hierarchy is not used in the locking. The characteristic is only used to define the hierarchy.
    In your example only the characteristics year and version are relevant for locking as these are the only ones used in the header selection. The data should be locked if the package selection is year = 2005 and version = V1. If you have a selection like year = 2005 and version = V1, V2 then the data is not locked as the selection is not completely contained in the header selection. Note that even if you only use version V1 in your selection but if you use a planning layout that has V2 in a comparison column then the system will enlarge the selection and data would not be locked.
    Best regards,
    Gerd Schoeffl
    SAPNetWeaver RIG BI

  • Get a date using Sql

    hi
    how i can get the following date using sql, ie i want to get '01-APR-2005'
    if the sysdate is between (01/04/2005 - 31/3/2006). in the same way if it is
    01/04/2004 - 31/3/2005 i want to get '01-apr-2004'...in the same way for any year..
    how i can get this...
    thx in adv
    Kris
    Message was edited by:
    Kris

    SQL> select dt, add_months(trunc(add_months(dt, -3), 'yyyy'), 3) new_dt
      2    from t
      3   order by dt;
    DT        NEW_DT
    01-APR-04 01-APR-04
    31-DEC-04 01-APR-04
    01-JAN-05 01-APR-04
    31-MAR-05 01-APR-04
    01-APR-05 01-APR-05
    31-DEC-05 01-APR-05
    01-JAN-06 01-APR-05
    31-MAR-06 01-APR-05
    8 rows selected.
    SQL> select add_months(trunc(add_months(sysdate, -3), 'yyyy'), 3) from dual;
    ADD_MONTH
    01-APR-05

  • How can I load my data faster?  Is there a SQL solution instead of PL/SQL?

    11.2.0.2
    Solaris 10 sparc
    I need to backfill invoices from a customer. The raw data has 3.1 million records. I have used pl/sql to load these invoices into our system (dev), however, our issue is the amount of time it's taking to run the load - effectively running at approx 4 hours. (Raw data has been loaded into a staging table)
    My research keeps coming back to one concept: sql is faster than pl/sql. Where I'm stuck is the need to programmatically load the data. The invoice table has a sequence on it (primary key = invoice_id)...the invoice_header and invoice_address tables use the invoice_id as a foreign key. So my script takes advantage of knowing the primary key and uses that on the subsequent inserts to the subordinate invoice_header and invoice_address tables, respectively.
    My script is below. What I'm asking is if there are other ideas on the quickest way to load this data...what am I not considering? I have to load the data in dev, qa, then production so the sequences and such change between the environments. I've dummied down the code to protect the customer; syntax and correctness of the code posted here (on the forum) is moot...it's only posted to give the framework for what I currently have.
    Any advice would be greatly appreciated; how can I load the data faster knowing that I need to know sequence values for inserts into other tables?
    DECLARE
       v_inv_id        invoice.invoice_id%TYPE;
       v_inv_addr_id    invoice_address.invoice_address_id%TYPE;
       errString        invoice_errors.sqlerrmsg%TYPE;
       v_guid          VARCHAR2 (128);
       v_str           VARCHAR2 (256);
       v_err_loc       NUMBER;
       v_count         NUMBER := 0;
       l_start_time    NUMBER;
       TYPE rec IS RECORD
          BILLING_TYPE             VARCHAR2 (256),
          CURRENCY                 VARCHAR2 (256),
          BILLING_DOCUMENT         VARCHAR2 (256),
          DROP_SHIP_IND            VARCHAR2 (256),
          TO_PO_NUMBER        VARCHAR2 (256),
          TO_PURCHASE_ORDER   VARCHAR2 (256),
          DUE_DATE                 DATE,
          BILL_DATE                DATE,
          TAX_AMT                  VARCHAR2 (256),
          PAYER_CUSTOMER           VARCHAR2 (256),
          TO_ACCT_NO          VARCHAR2 (256),
          BILL_TO_ACCT_NO          VARCHAR2 (256),
          NET_AMOUNT               VARCHAR2 (256),
          NET_AMOUNT_CURRENCY      VARCHAR2 (256),
          ORDER_DT             DATE,
          TO_CUSTOMER         VARCHAR2 (256),
          TO_NAME             VARCHAR2 (256),
          FRANCHISES       VARCHAR2 (4000),
          UPDT_DT                  DATE
       TYPE tab IS TABLE OF rec
                      INDEX BY BINARY_INTEGER;
       pltab           tab;
       CURSOR c
       IS
          SELECT   billing_type,
                   currency,
                   billing_document,
                   drop_ship_ind,
                   to_po_number,
                   to_purchase_order,
                   due_date,
                   bill_date,
                   tax_amt,
                   payer_customer,
                   to_acct_no,
                   bill_to_acct_no,
                   net_amount,
                   net_amount_currency,
                   order_dt,
                   to_customer,
                   to_name,
                   franchises,
                   updt_dt
            FROM   BACKFILL_INVOICES;
    BEGIN
       l_start_time := DBMS_UTILITY.get_time;
       OPEN c;
       LOOP
          FETCH c
          BULK COLLECT INTO pltab
          LIMIT 1000;
          v_err_loc := 1;
          FOR i IN 1 .. pltab.COUNT
          LOOP
             BEGIN
                v_inv_id :=  SEQ_INVOICE_ID.NEXTVAL;
                v_guid := 'import' || TO_CHAR (CURRENT_TIMESTAMP, 'hhmissff');
                v_str := str_parser (pltab (i).FRANCHISES); --function to string parse  - this could be done in advance, yes.
                v_err_loc := 2;
                v_count := v_count + 1;
                INSERT INTO    invoice nologging
                     VALUES   (v_inv_id,
                               pltab (i).BILL_DATE,
                               v_guid,
                               '111111',
                               'NONE',
                               TO_TIMESTAMP (pltab (i).BILL_DATE),
                               TO_TIMESTAMP (pltab (i).UPDT_DT),
                               'READ',
                               'PAPER',
                               pltab (i).payer_customer,
                               v_str,
                               '111111');
                v_err_loc := 3;
                INSERT INTO    invoice_header nologging
                     VALUES   (v_inv_id,
                               TRIM (LEADING 0 FROM pltab (i).billing_document), --invoice_num
                               NULL,
                               pltab (i).BILL_DATE,                 --invoice_date
                               pltab (i).TO_PO_NUMBER,
                               NULL,
                               pltab (i).net_amount,
                               NULL,
                               pltab (i).tax_amt,
                               NULL,
                               NULL,
                               pltab (i).due_date,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               TO_TIMESTAMP (SYSDATE),
                               TO_TIMESTAMP (SYSDATE),
                               PLTAB (I).NET_AMOUNT_CURRENCY,
                               (SELECT   i.bc_value
                                  FROM   invsvc_owner.billing_codes i
                                 WHERE   i.bc_name = PLTAB (I).BILLING_TYPE),
                               PLTAB (I).BILL_DATE);
                v_err_loc := 4;
                INSERT INTO    invoice_address nologging
                     VALUES   (invsvc_owner.SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
                               v_inv_id,
                               'BLAH INITIAL',
                               pltab (i).BILL_DATE,
                               NULL,
                               pltab (i).to_acct_no,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               SYSTIMESTAMP,
                               NULL);
                v_err_loc := 5;
                INSERT INTO    invoice_address nologging
                     VALUES   ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
                               v_inv_id,
                               'BLAH',
                               pltab (i).BILL_DATE,
                               NULL,
                               pltab (i).TO_ACCT_NO,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               SYSTIMESTAMP,
                               NULL);
                v_err_loc := 6;
                INSERT INTO    invoice_address nologging
                     VALUES   ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
                               v_inv_id,
                               'BLAH2',
                               pltab (i).BILL_DATE,
                               NULL,
                               pltab (i).TO_CUSTOMER,
                               pltab (i).to_name,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               SYSTIMESTAMP,
                               NULL);
                v_err_loc := 7;
                INSERT INTO    invoice_address nologging
                     VALUES   ( SEQ_INVOICE_ADDRESS_ID.NEXTVAL,
                               v_inv_id,
                               'BLAH3',
                               pltab (i).BILL_DATE,
                               NULL,
                               'SOME PROPRIETARY DATA',
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               NULL,
                               SYSTIMESTAMP,
                               NULL);
                v_err_loc := 8;
                INSERT
                  INTO    invoice_event nologging (id,
                                                             eid,
                                                             root_eid,
                                                             invoice_number,
                                                             event_type,
                                                             event_email_address,
                                                             event_ts)
                VALUES   ( SEQ_INVOICE_EVENT_ID.NEXTVAL,
                          '111111',
                          '222222',
                          TRIM (LEADING 0 FROM pltab (i).billing_document),
                          'READ',
                          'some_user@some_company.com',
                          SYSTIMESTAMP);
                v_err_loc := 9;
                INSERT INTO   backfill_invoice_mapping
                     VALUES   (v_inv_id,
                               v_guid,
                               pltab (i).billing_document,
                               pltab (i).payer_customer,
                               pltab (i).net_amount);
                IF v_count = 10000
                THEN
                   COMMIT;              
                END IF;
             EXCEPTION
                WHEN OTHERS
                THEN
                   errString := SQLERRM;
                   INSERT INTO   backfill_invoice_errors
                        VALUES   (
                                    pltab (i).billing_document,
                                    pltab (i).payer_customer,
                                    errString || ' ' || v_err_loc
                   COMMIT;
             END;
          END LOOP;
          v_err_loc := 10;
          INSERT INTO   backfill_invoice_timing
               VALUES   (
                           ROUND ( (DBMS_UTILITY.get_time - l_start_time) / 100,
                                  2)
                           || ' seconds.',
                           (SELECT   COUNT (1)
                              FROM   backfill_invoice_mapping),
                           (SELECT   COUNT (1)
                              FROM   backfill_invoice_errors),
                           SYSDATE
          COMMIT;
          EXIT WHEN c%NOTFOUND;
       END LOOP;
       COMMIT;
    EXCEPTION
       WHEN OTHERS
       THEN
          errString := SQLERRM;
          INSERT INTO   backfill_invoice_errors
               VALUES   (NULL, NULL, errString || ' ' || v_err_loc);
          COMMIT;
    END;

    Hello
    You could use insert all in your case and make use of sequence.NEXTVAL and sequence.CURRVAL like so (excuse any typos - I can't test without table definitions). I've done the first 2 tables, so it's just a matter of adding the rest in...
    INSERT ALL
         INTO      invoice nologging
                    VALUES   (     SEQ_INVOICE_ID.NEXTVAL,
                                   BILL_DATE,
                                    my_guid,
                                    '111111',
                                    'NONE',
                                    CAST(BILL_DATE AS TIMESTAMP),
                                    CAST(UPDT_DT AS TIMESTAMP),
                                    'READ',
                                    'PAPER',
                                    payer_customer,
                                    parsed_francises,
                                    '111111'
         INTO      invoice_header
              VALUES   (      SEQ_INVOICE_ID.CURRVAL,
                        TRIM (LEADING 0 FROM billing_document), --invoice_num
                        NULL,
                        BILL_DATE,                 --invoice_date
                        TO_PO_NUMBER,
                        NULL,
                        net_amount,
                        NULL,
                        tax_amt,
                        NULL,
                        NULL,
                        due_date,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        SYSTIMESTAMP,
                        SYSTIMESTAMP,
                        NET_AMOUNT_CURRENCY,
                        bc_value,
                        BILL_DATE)
         SELECT 
         src.billing_type,
              src.currency,
              src.billing_document,
              src.drop_ship_ind,
              src.to_po_number,
              src.to_purchase_order,
              src.due_date,
              src.bill_date,
              src.tax_amt,
              src.payer_customer,
              src.to_acct_no,
              src.bill_to_acct_no,
              src.net_amount,
              src.net_amount_currency,
              src.order_dt,
              src.to_customer,
              src.to_name,
              src.franchises,
              src.updt_dt,
              str_parser (src.FRANCHISES) parsed_franchises,
              'import' || TO_CHAR (CURRENT_TIMESTAMP, 'hhmissff') my_guid,
              i.bc_value
            FROM        BACKFILL_INVOICES src,
                 invsvc_owner.billing_codes i
         WHERE   i.bc_name = src.BILLING_TYPE;Some things to note
    1. Don't commit in a loop - you only add to the run time and load on the box ultimately reducing scalability and removing transactional integrity. Commit once at the end of the job.
    2. Make sure you specify the list of columns you are inserting into as well as the values or columns you are selecting. This is good practice as it protects your code from compilation issues in the event of new columns being added to tables. Also it makes it very clear what you are inserting where.
    3. If you use WHEN OTHERS THEN... to log something, make sure you either rollback or raise the exception. What you have done in your code is say - I don't care what the problem is, just commit whatever has been done. This is not good practice.
    HTH
    David
    Edited by: Bravid on Oct 13, 2011 4:35 PM

  • How can I validate data after writing and over reboot/powercycle?

    Hi,
    How can I validate data after writes are done? How can I validate data after reboot or powercycle of the machine is done?
    What are the options I should give while running vdbench? When should I use -v, -vq, -vt, -v -j, -vq -j, -vq -jr, -v -jr options?

    Please look for the "Data Validation and Journaling' chapter in the documentation.
    Henk.

  • I lost my iPhone device, how can I get my data back on another one without using an iCloud backup just back up on i Tunes, Please Help.

    I lost my iPhone device, how can I get my data back on another one without using an iCloud backup just back up on i Tunes, Please Help.??

    You can find the backup files and then copy them to a safe place if you are worrying about this.
    iTunes places the backup files in these places:
    Mac: ~/Library/Application Support/MobileSync/Backup/
    The "~" represents your Home folder. If you don't see Library in your Home folder, hold Option and click the Go menu.
    Windows Vista, Windows 7, and Windows 8: \Users\(username)\AppData\Roaming\Apple Computer\MobileSync\Backup\
    To quickly access the AppData folder, click Start. In the search bar, type %appdata%, then press Return.
    Windows XP: \Documents and Settings\(username)\Application Data\Apple Computer\MobileSync\Backup\
    To quickly access the Application Data folder, click Start, then choose Run. In the search bar, type %appdata%, then click OK.

  • How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    How can I restore my data from iCal? I didn't make any backup, but I use  time machine with an external HD. I deleted iCal when I deleted my gmail account. I have tried to restore, but I can only restore the iCal software and not the data.

    So what is your question?
    If you forgot your encryption password:
    Warning: Make sure it's a password you will remember or write it down for safekeeping. If you encrypt an iPhone backup in iTunes and forget your password, you can't restore from backup and your data will be unrecoverable.
    If you can't remember the password and want to start again, you must perform a full software restore and chooseset up as a new device when iTunes prompts you to select the backup from which to restore.
    The above comes from here:
    http://support.apple.com/kb/HT4946

  • How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap?

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class? These are the keys,values: TreeMap The data I'd like to Cache is (date from the file, time of the file, current time).
    import java.io.*;
    public class CacheData {
      public static void main(String[] args) throws IOException {
      String target_dir = "C:\\Files";
      String output = "C:\\Files\output.txt";
      File dir = new File(target_dir);
      File[] files = dir.listFiles();
      // open the Printwriter before your loop
      PrintWriter outputStream = new PrintWriter(output);
      for (File textfiles : files) {
      if (textfiles.isFile() && textfiles.getName().endsWith(".txt")) {
      BufferedReader inputStream = null;
      // close the outputstream after the loop
      outputStream.close();
      try {
      inputStream = new BufferedReader(new FileReader(textfiles));
      String line;
      while ((line = inputStream.readLine()) != null) {
      System.out.println(line);
      // Write Content
      outputStream.println(line);
      } finally {
      if (inputStream != null) {
      inputStream.close();

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class?
    I don't understand your question.
    If you don't know how to use TreeMap why do you think a TreeMap is the correct solution for what you want to do?
    If you are just asking how to use TreeMap then there are PLENTY of tutorials on the internet and the Java API provides the methods that area available.
    TreeMap (Java Platform SE 7 )
    Are you sure you want a map and not a tree instead?
    https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html

  • How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    How can I get my data from a old iPad to a new iPad using iCloud and not iTunes

    Restore from the iCloud backup - assuming that you were backing up to iCloud in the first place. If you weren't using iCloud for backup - then you are out of luck.
    If you were backing up to iCloud - you have to erase all contents on the iPad in Settings>General>Reset>Erase all content and settings - before you can restore from the iCloud backup.
    Read this article before you do anything else
    http://gigaom.com/apple/ios-101-set-up-and-restore-from-icloud-backup/

Maybe you are looking for

  • K7N2 Delta problems

    Hey all..having a huge problem with my computer and have no idea what's going on.....when i try to reformat, i am getting errors with blue screen. errors are as follows: Page_Fault_In_Non_Paged_Area followed by the stop error numbers                

  • Need a VB-Script that read a txt-file and only the lines that are new since last time

    Hi, I need help to write a VB script that read all new lines since the last time. For example:  The script reads the textfile at specific time, then 10 minutes later the script read the file again, and it should now only read the lines that are new s

  • How to overwrite an array?

    I am trying to overwrite the values in an array, but I am getting an ArrayIndexOutofBoundsException. This is how I am attempting to do it: if ((checkTempEnergy(tempDistance, numIons, Q)) < (checkEnergy(distance, numIons, Q))) {      for (int i=0; i <

  • UITableView Search Controller & Heading Titles (iPhone OS 3.1)

    +More of a continuation from a previous thread to discuss a more specific issue+ → Ray, I could never get the Sections project to work. I had checked the code, but it still didn't load. I had tried taking some code out of the book. The initial proble

  • Error sqlldr with plink in remote command

    Hi all, My OS is Windows, I tried to launch a sqlldr remote command with plink (putty) : Command dos: "plink host -l oracle -pw oracle sqlldr -userid schema/pwd -control /tmp/test.ctl" I had this error : "ksh: sqlldr: not found" Setting of server : $