Re: help w/shell program
Posted in 1997
Teresa Crowl wrote:
>
> Does anyone know how I would write a shell program to
> take sql statements from a file and execute them
> via dbaccess?
>
> ie:
> file name: adt_transactions
> data is:
> insert into patient_census VALUES("04/04/1997","A04","BC","3045","A")
> insert into patient_census VALUES("04/04/1997","A04","WC","4045","A")
> insert into patient_census VALUES("04/04/1997","A04","BC","3047","B")
> TIA
> Teresa Crowl
> tjc@umbra.pvh.org
dbaccess database_name file_name
I.E dbaccess db adt_transactions
Also for your example your could try:
file data:
04/04/1997|A04|BX|3045|A|
04/04/1997|A04|WC|4045|A|
04/04/1997|A04|BC|3047|B|
...
shell script:
dbaccess database_name <<xxENDxx
LOAD FROM "file_name"
INSERT INTO patient;
xxENDxx
NOTE: the xxENDxx is simply my method of delimiting the finish block.
S.W.
--
wilcoxon@pioneerplanet.infi.net
**********************************************************************
... this is only a test
... if this had been a real signature it would have been interesting
**********************************************************************