如题:
**********************write sql into file**************************
ScriptPath = "/EDWETL/P09IDS_ECIF/Script/Import_ECIF_EDW/"
Pathname = ScriptPath : "edw_sql_con.sql"
sWORKDATE = ""
sqlstr = "select paramname,paramvalue from edw_etl_config;"
*open sql file
OpenSeq Pathname To FileVar LOCKED
FilePresent = @True
End Then
FilePresent = @True
End Else
FilePresent = @False
End
*truncate content of file
WeofSeq FileVar
*write content of file
ErrorStr = "write file successful"
*get truncate sql string
*Trstr = "Truncate table edw_etl_log;"
setstr = "set echo off newpage 0 space 0 pagesize 0 feed off head off trimspool on;"
*WriteSeq Trstr To FileVar Else
*ErrorStr = "can not write file"
*End
WriteSeq setstr To FileVar Else
ErrorStr = "can not write file"
End
WriteSeq "SPOOL " : ScriptPath : "edw_sql_rs.txt;" To FileVar Else
ErrorStr = "can not write file"
End
WriteSeq sqlstr To FileVar Else
ErrorStr = "can not write file"
End
WriteSeq "SPOOL OFF;" To FileVar Else
ErrorStr = "can not write file"
End
WriteSeq "quit" To FileVar Else
ErrorStr = "can not write file"
End
*close file
CloseSeq FileVar
Call DSLogInfo("write sql file: ":ErrorStr, "EDW_SetParam")
********************exec sql,write config info into result file******************************
*get the exec sql shell file
cmd=ScriptPath : "edw_exec_sql.sh"
*execute shell command
Call DSExecute ("UNIX",cmd, Output, SystemReturnCode)
Call DSLogInfo("exe sql: ":Output, "EDW_SetParam")
********************************get sql result string***********************************