|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
First just so you know I have never programmed in UNIX, but have programmed in other languages.. With that being said all I want to do is this: run a unitscript passing 1 parameter ex: fci_trans_xp.sh 4 in the fci_trans_xp script I want to insert that value into a table So: parm1=$1 (which I assume = 4)?? The line below is my login to Teradata SQL cat $dwmod/logon/fxport.tlg > $dwrunmod/fci_trans_xpf1.rf What I need to know is how to write the insert into UNIX. insert into cses_dev.tablename (column1) values (parm1) First is the syntax correct above? Second what do I need to make that insert stmt execute? The rest in the middle I think I can figure out. I just dont know how to execute a sql statement within UNIX. Sorry if this is really a stupid question.. thanks moonflower |
|
#2
|
|||
|
|||
|
Don't know Teradata. Don't know the SQL stuff very well just to be upfront.
But MySQL and Postgre have command line tools to read a db login and password and a SQL command. Command mysql for MySQL (duh) and pgsql (I think) for Postgre. Maybe Teradata has similar. Code:
mysql -u db_user -ppassword -e 'sql_command' the_db_name for mysql. script example Code:
#!/bin/sh parm1="$1" #quote your variables, not always necessary but it doesn't hurt mysql -u db_user -ppassword -e 'sql_command' the_db_name #all the rest Some thing like that. |
|
#3
|
|||
|
|||
|
Newbie Help
Although I would think your syntax would work our Teradata login is kept in a separate file. I would have to call that file to get logon information, thus the sql stmt needs to be a separate entity within the unix script..
This is where I am getting lost on how to execute it. thanks moon |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Newbie needs assistance writing script. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|