Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I'm trying to get this script to execute an insert after verifying that the requirements are satisfied. the logic gets as far as the insert and I recieve this error:
0403-057 Syntax error at line 48 : `(' is not expected.
Here is the script:
#!/bin/ksh
. /adwprod/di/jobserver/11.5/bin/al_env.sh
. /adwprod/env/setOracle.shJOB_SUCCESS_STATUS=0
JOB_SUCCESS_STATUS=`sqlplus -s aiwadmin/tawanai@adwp <<xx
set head off
set feedback off
select count(*) from aiw_table_load_status
where table_name='VENDOR'
and bo_environment='PROD'
and load_region_cd='GBL'
and run_dt = trunc(sysdate-1);
xx
`JOB_SUCCESS_STATUS=`sqlplus -s aiwadmin/tawanai@adwp <<xx
set head off
set feedback off
select count(*) from aiw_table_load_status
where table_name='CUSTOMER'
and bo_environment='PROD'
and load_region_cd='GBL'
and run_dt = trunc(sysdate-1);
xx
`JOB_SUCCESS_STATUS=`sqlplus -s aiwadmin/tawanai@adwp <<xx
set head off
set feedback off
select count(*) from aiw_table_load_status
where table_name='CUSTOMER_SALES_ORG'
and bo_environment='PROD'
and load_region_cd='GBL'
and run_dt = trunc(sysdate-1);
xx
`while [[ ${JOB_SUCCESS_STATUS} -ne 1 ]] ; do
echo ${JOB_SUCCESS_STATUS}
sleep 900if [ ${JOB_SUCCESS_STATUS} -eq 1 ];
then
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('VENDOR','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd, run_dt,last_status_cd,bo_environment,status_upd_date,job_na
me,rowcnt_status_flg) values ('CUSTOMER','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('CUSTOMER_SALES_ORG','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_Sales_Dimension_Load',
null);
commit;fi
exitWhere did I go wrong?

I am not an Oracle/sqlplus person, but it looks like you are trying to execute an SQL at line 48:
insert into aiw_table_load_status .....
Don't you want this within an sqlplus command block???

It is an SQL statement. I figured it would work this way ? How would you do it in an
sqlplus command block???

The shell is interpreting "insert" as a valid unix command.
Like I said, I'm not an Oracle guy, but I would expect it would be something like this:
sqlplus -s aiwadmin/tawanai@adwp <<xx
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('VENDOR','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd, run_dt,last_status_cd,bo_environment,status_upd_date,job_na
me,rowcnt_status_flg) values ('CUSTOMER','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('CUSTOMER_SALES_ORG','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_Sales_Dimension_Load',
null);
commit;
xxBut I'm just guessing.
You might look at this link:

You were 100% correct and I figured it out right after you suggested that I put in within an sqlplus command block:
sqlplus -s aiwadmin/tawanai@adwp <<EOF
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('VENDOR','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd, run_dt,last_status_cd,bo_environment,status_upd_date,job_na
me,rowcnt_status_flg) values ('CUSTOMER','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_MasterData_D',null);
insert into aiw_table_load_status (table_name,load_region_cd,run_dt,last_status_cd,bo_environment,status_upd_date,job_nam
e,rowcnt_status_flg) values ('CUSTOMER_SALES_ORG','INT',trunc(sysdate),'COMPLETE','PROD',sysdate,'J_RM_Sales_Dimension_Load',
null);
commit;
EOFWorked fine.
Thanks for your help.

![]() |
Will ibm aix run mac os x...
|
korn shell help
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |