Re: SQLLDR syntax question
From: ddf <oratune_at_msn.com>
Date: Tue, 9 Mar 2010 14:07:59 -0800 (PST)
Message-ID: <0822287e-0387-428a-a7bb-869370fa5313_at_v34g2000prm.googlegroups.com>
On Mar 8, 9:56 am, Kay Kanekowski <kay.kanekow..._at_web.de> wrote:
> Hi Martin,
> you need a function that calculate your "string" data.
> That's my try:
>
> create or replace function fn_kk_calc ( string_in IN varchar2 ) return
> number
> is
> erg number;
> begin
> execute immediate 'select ' || string_in || ' from dual' into erg;
> return erg;
> end;
> /
>
> LOAD DATA
> INFILE math.txt
> INTO TABLE kk_math
> REPLACE
> FIELDS TERMINATED BY ','
> OPTIONALLY ENCLOSED BY '"'
> (
> id1 integer external "fn_kk_calc(:id1)",
> id2 integer external
> )
>
> hth
> Kay
Date: Tue, 9 Mar 2010 14:07:59 -0800 (PST)
Message-ID: <0822287e-0387-428a-a7bb-869370fa5313_at_v34g2000prm.googlegroups.com>
On Mar 8, 9:56 am, Kay Kanekowski <kay.kanekow..._at_web.de> wrote:
> Hi Martin,
> you need a function that calculate your "string" data.
> That's my try:
>
> create or replace function fn_kk_calc ( string_in IN varchar2 ) return
> number
> is
> erg number;
> begin
> execute immediate 'select ' || string_in || ' from dual' into erg;
> return erg;
> end;
> /
>
> LOAD DATA
> INFILE math.txt
> INTO TABLE kk_math
> REPLACE
> FIELDS TERMINATED BY ','
> OPTIONALLY ENCLOSED BY '"'
> (
> id1 integer external "fn_kk_calc(:id1)",
> id2 integer external
> )
>
> hth
> Kay
This all seems to be far more work than necessary simply to enable the use of some round-about 'calculation' rather than coding the numeric values desired. Yes, it's creative, but having to write a funciton to process the mathematical gyrations loaded into the inline data unnecessarily complicates a fairly basic data load. Has no one heard of Occam's Razor? Paraphrased:
"The simplest solution is the best"
It's simplest in this situation to code 10 rather than 1+9; interesting as the other offerings may be they are merely baroque additions to what should be a minimalist execution.
David Fitzjarrell Received on Tue Mar 09 2010 - 16:07:59 CST