Unanswered: Oracle DB Connection and spool data in text file
I want to create bat file to connect oracle database with passing parameters username, password.
After that, i have queries, so i can retrieve data and with spool command write data on txt files. name of file can be generated with user input and substitution variable.
Simply this is the logic for import data from oracle database.
But i want it programatically.
Can anybody help me. I did little coding as follows and it works. Now i want introduce user input in it.
EXTRACT.bat as follows ...
CREATE OR REPLACE DIRECTORY UPLOAD
GRANT READ,WRITE ON DIRECTORY UPLOAD TO user1;
sqlplus user1/userpass@host @c:\log_dir\populate.sql
and in populate.sql file as follows...(here i need date as user input)
SET TERM OFF
SET HEADING OFF
SET HEAD ON
SET PAGESIZE 0
SET TRIMSPOOL ON
SET TRIMOUT ON
SET FEEDB OFF
SET COLSEP "|"
SET LINESIZE 1000
select * from tb_rule;