Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ProC/C++ question urgent!

Re: ProC/C++ question urgent!

From: Mike Streeton <mstreeton_at_caci.co.uk>
Date: 1997/09/24
Message-ID: <01bcc8de$eecf7700$ea2a46c2@Birmingham_Dev3.caci.co.uk>#1/1

Sam,

        Try using the native date time Char(6), the date is encoded in this, look at the ProC manual for the format. This is very fast, but it is not validated at all so you can set up dates such as the 31st of Feburary or worse

Hope this helps

Mike

Sam Volba <sv_at_megalinx.net> wrote in article <01bcbe5b$2fc6f280$0ace29d1_at_sfinance3>...
>
> I have the following problem:
>
> I need to insert into a table where some columns have DATE format.
> For example a table MYTABLE:
> (
> ACCOUNT_NUMBER NUMBER,
> DATE_SYS DATE
> )
>
> the thing is the DATE_SYS can be beyond year 2000, so the "default"
 format
> 'DD-MON-YY' doesn't work correctly (e.g. '01-FEB-02' is interpreted as
> Feb.01, 1902,
> not Feb.01,2002 as it should have). That's why I have to use 'RRMMDD'
> format.
> I use the following INSERT statement to populate the table:
>
> double acctno;
> char dsys[7];
> [.. code which initializes acctno and dsys ...]
> EXEC SQL AT MYDBASE INSERT INTO MYTABLE VALUES
> (:acctno, TO_DATE(:dsys,'RRMMDD'));
>
> It works OK without problems. The problem is, however, in performance.
> I have to insert millions of rows with AVG_ROW_LEN = 220 into a table
> similar to above
> only with 74 columns instead of 2,
> and it takes a whole day to do this using the INSERT statement similar to
> above.
>
> I believe I can impove significantly if I somehow can get rid of TO_DATE
> function call
> and load DATE fields directly. Also I would want to use bind array to
> insert a couple hundred
> rows in one INSERT statement, and TO_DATE function call prevents me from
> doing this.
>
> So the more specific question is, can I do something like this ?:
> EXEC SQL AT MYDBASE INSERT INTO MYTABLE VALUES (acctno, :dsys)
>
> where dsys is NOT in "default" 'DD-MON-YY' format.
> And if I can, what type of variable dsys should be and how do I
 initialize
> it so Oracle does not throw up with "inconsistent datatype" error ?
> I tried to make dsys a double, and long, and make it equal the number of
> seconds since
> year 1970, but Oracle invariably threw up with "incompatible datatype"
> error for the DATE_SYS field.
>
> Thanks for any suggestions,
> Sam
>
>
>
>
  Received on Wed Sep 24 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US