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

Home -> Community -> Usenet -> c.d.o.misc -> Re: call sql oracle 8.i with unix script fails

Re: call sql oracle 8.i with unix script fails

From: Ana C. Dent <anacedent_at_hotmail.com>
Date: Sat, 13 Jan 2007 22:54:15 GMT
Message-ID: <Xns98B7979DFCADanacedenthotmailcom@69.28.173.184>


"Ed Yin" <vraagme_at_hotmail.nl> wrote in
news:55d2c$45a931d4$50398baa$10404_at_news.chello.nl:

>
> "Ana C. Dent" <anacedent_at_hotmail.com> schreef in bericht
> news:Xns98B75773EF9AEanacedenthotmailcom_at_69.28.173.184...

>> "Ed Yin" <vraagme_at_hotmail.nl> wrote in
>> news:497fd$45a8d9e9$50398baa$23489_at_news.chello.nl:
>>
>>>
>>> "Ana C. Dent" <anacedent_at_hotmail.com> schreef in bericht
>>> news:Xns98B6C3B00D8B6anacedenthotmailcom_at_69.28.173.184...
>>>> "Ed Yin" <vraagme_at_hotmail.nl> wrote in
>>>> news:4abdb$45a7d753$50398baa$18065_at_news.chello.nl:
>>>>
>>>>> hello,
>>>>>
>>>>> maybe someone can help me out on this script it will only execute
>>>>> 1 sql statement depending on what file_name what is wrong with
>>>>> what i am trying to do?
>>>>>
>>>>>
>>>>> i try to call a sql like this depending on interface type
>>>>>
>>>>>     this shell is called rim started like this  ./rim POR AL
>>>>>     where POR
>>>>> is type en AL = $2 file name in this test
>>>>>
>>>>>
>>>>>       $1=INTTYPE
>>>>>       file_name='test.por'
>>>>>       typeO=ORD
>>>>>       typeP=POR
>>>>>
>>>>>       if  $1=$typeO
>>>>>            then
>>>>>        sqlplus -s / @ord_controle.sql $2 $file_name <<F /
>>>>>         echo processing $typeO $1 $sql1 $file_name
>>>>>         else $1=$typeP
>>>>>         sqlplus -s / @por_controle.sql $2 $file_name <<F /
>>>>>         echo processing $typeP $1 $sql2 $file_name
>>>>> show errors;
>>>>> F
>>>>>    fi
>>>>> exit 0
>>>>>
>>>>> thanks Ed
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> First make ity work, then make it fancy.
>>>> I've done *nix for 20+ years & Oracle for 10+
>>>> & for the life of me I have no idea what you are doing.
>>>> It kind of appears you are trying some form of here script,
>>>> which make absolutely no sense inside a shell's "if" statement.
>>>
>>> what I am trying to do is this:
>>>
>>> inside a unix shell there is 1 sql command and it uses processtype
>>> parameter $1 , company $2 and parameter $file_name as collected
>>> filename wich conatins the data witch we need to process and what i
>>> want to try is this
>>>
>>> if parameter $1 is equal to process type ORD
>>> then do
>>>
>>> "sqlplus -s / @ord_controle.sql $2 $file_name <<F
>>>  /
>>> show errors;
>>> F "
>>> this sql statement is checking the transmission data form the file
>>> in a transmission table and what i want to do is adding next
>>> statement or sql inside this shell script.
>>>
>>>
>>> if paramater $1 is equal to POR
>>> then next sql  is needed to perform checks in database transmission
>>> table
>>>
>>> "sqlplus -s / @por_controle.sql $2 $file_name <<E
>>>  /
>>> show errors;
>>> E"
>>>
>>> extra note is besides the procestype also the extension of the file
>>> is differend and i parsed it into parameter $ext but i did not used
>>> it. 
>>>
>>> hope even when it is not clear to you it gives an idea what i try to
>>> do.
>>>
>>> thanks Ed
>>>
>>>
>>>
>>>
>>
>> A little knowledge is a dangerous commodity.
>> IMO, I would not use in combination @myname.sql AND <<E (here script)
>> I use one or the other but NEVER tried using in combination.
>> Try "encapsilation" create small working & bulletproof scripts which
>> do 1 thing well & one thing only. Call/invoke it when appropriate.
>>
>> Unless I am still sleep walking, you have NEVER actually stated what
>> is wrong. You imply a problem, but I have no idea what you are seeing
>> & what you are posting about.
>>
>> Typically many scripts run in background. I see NO benefit of
>> including SHOW ERROR;
>> 'cuz your code can't take action based upon its output.

>
> that i have little knowlegde is obvious but only the fool learns from
> his own mistakes the intelligent one learns from others, so i try to
> be the second :)
>
> The problem i have with the script i first mentioned
> was that it only executed the first sql with processtype ORD and not
> the second when processtype POR was used and parsed to the unix shell.
>
> the show error is used to put down into logging to read and has no
> other function. The actual control(file data) is done by sql but
> having said that the unix script has to activate the right sql at
> first.
>
> The real problem i have is that i am not sure why the processtype
> "POR" not calls the second sql.
>
> thanks,
>
> Ed
>
>

I am about ready to abandon this thread. You insist upon telling what you think is happening & what you are doing rather than simply doing cut & paste to show EXACTLY what is or is not happening.
You seem to be on some sort of *nix system of unknown name & version. You seem to be using some sort of shell; (csh, sh, bash, which???) Visibility into what is or is not happening can be obtained by: $ sh -x ./rim POR AL

Rhetorical question - Do you actually understand what $1 or $2 are & how they should be used in a script?

HAND! Received on Sat Jan 13 2007 - 16:54:15 CST

Original text of this message

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