I have the following ksh, test.ksh, which call an sql script:
sqlplus user/passwrd @testChange.sql
My testChange.sql is as follows:
spool testChange.log
SET serveroutput ON;
SET linesize 350;
ALTER SESSION SET nls_date_format='dd/mm/yyyy hh24:mi:ss';
DECLARE
nbCharAlterer NUMBER;
BEGIN
nbCharAlterer:= 3;
USER.PKG_TEST_CHANGE.ALTER ( nbCharAlterer => nbCharAlterer) ;
END;
/
spool off;
exit;
The head of my package is as follows:
create or replace package PKG_TEST_CHANGE AUTHID CURRENT_USER is
nbCharAlterer number:=3;
TYPE t_array IS TABLE OF VARCHAR2(50) INDEX BY BINARY_INTEGER;
procedure alterer(nbCharAlterer in number );
end PKG_TEST_CHANGE;
The body of my package is as follows:
create or replace package body PKG_TEST_CHANGE as
compteur PLS_INTEGER := 0;
nbCharAlterer PLS_INTEGER := 3;
nbParallel PLS_INTEGER := 8
PROCEDURE ALTER(
nbCharAlterer IN NUMBER)
IS
CURSOR SQL_TABLE IS
SELECT TABLE_OWNER,TABLE_NAME,COLUMN_NAME,TYPE,SEPARATE,PATTERN,ID FROM
ALTERE_PARAM ;
sTable sys.ALL_TAB_COLUMNS.table_name%TYPE;
sOwner sys.ALL_TAB_COLUMNS.owner%TYPE;
sColumn sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;
sType sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;
sPattern ALTERE_PARAM.PATTERN%TYPE;
sSeparator ALTERE_PARAM.SEPARATE%TYPE;
sId sys.ALL_TAB_COLUMNS.COLUMN_NAME%TYPE;
nNbTable number;
BEGIN
dbms_output.put_line(' ' ||TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MI')||' => Database changing');
DBMS_APPLICATION_INFO.SET_CLIENT_INFO('Alter');
....Some code
END ALTER;
end PKG_TEST_CHANGE;
I want my dbms_output.put_line('') to be recorded in a log file. I have run my ksh as below:
nohup ./test.ksh > alterTest.log &
My log file has only one line with 'Session altered.'. Any idea why my log is not working in the proper way? I am using Oracle 10g.