-
save my last run SQL command
hi
i have a requirement where i want to save or spool my last run SQl command in a txt file .
for Example:
i run first command : INSERT INTO ABC VALUES ('A');
now when i run second command : UPDATE ABC SET TYPE='B';
i want to save/spool my last SQl command (insert statement)
in a txt file or anywhere else.
so is there any SQL script for that.
pls help me out
thanx
-
Use the SPOOL command.
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
-
Code:
SQL> select * from dual;
D
-
X
SQL> spool last_statement.txt
SQL> list
1* select * from dual
SQL> spool off
-
SQL> spool c:\ocp_project\last_record.txt
SQL> INSERT INTO ABC VALUES ('A');
1 record inserted
SQL> UPDATE ABC SET TYPE='B';
updated
SQL> spool off;
check the file in the specified dir.
-
implicit or autospool of last run SQL command
thanx
that i know. but i am looking for auto spool of my sql command.
i have not to save any specific or single command explicitly.
my requirement is that whenever i run a SQL command at sql prompt
my last SQL command or ,alternatively, the current command should get spooled implicitly or automatically to a txt file.
i dont want to spool manually by writting spool command after each of my SQL command.
is there any script for that.
looking for help.
thanx
-
binoyshill:
my requirement is that whenever i run a SQL command at sql prompt
my last SQL command or ,alternatively, the current command should get spooled implicitly or automatically to a txt file.
Looks that something to do with auditing.
Why dont you audit all the successful statements of the session and transfer the data to a text files from Data Dictionaries.
-
which Data Dictionary should i look for.
since iam not into DBa sort of things so its bit difficult for me to do
audit.
tell me other way to implicit spool of commands into text file
thancx
-
Or you can use a tool like Oracle SQL*Worksheet, Oracle SQL Developer, TOAD, etc... which automatically keep SQL statement history.
"The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|