Created
March 12, 2019 20:00
-
-
Save a2gs/54be89c67215caeca3a8f3a787f604b6 to your computer and use it in GitHub Desktop.
Shell script accessing Oracle DB little sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
DATA=`date +'%d%m%Y'` | |
TABELA=TABELA_ABC | |
CAMPO=DATA_CRIACAO | |
TEMPO=30 | |
DB_USER=db_user | |
DB_PASSWORD=db_user_password | |
DB_INSTANCE=connection_instance | |
sqlplus "$DB_USER/$DB_PASSWORD@$DB_INSTANCE" << SQL_EOF > SQL_OUT.text | |
select * from $TABELA where $CAMPO >= TO_DATE('$DATA', 'DDMMYYYY')-$TEMPO; | |
commit; | |
SQL_EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment