oravirt / ansible-oracle-modules

Oracle modules for Ansible
MIT License
214 stars 159 forks source link

Running a select statement as script #125

Closed anandsolomon closed 4 years ago

anandsolomon commented 4 years ago

Hi, I am trying to run a sql script which has simple select statement. (select username from dba_users). Will oracle_sql module run a "Select" statement and returns the results ?

I am getting "{"changed": false, "msg": "Something went wrong while executing sql - ORA-00972: identifier is too long sql: \"Finished running script /home/ansible/Compliance.sql \nContents: \nselect username\\n \ from dba_users\""}

The debug output is as below:

TASK [Display the query results] **** ok: [22.174.101.30] => (item=msg.stdout) => { "msg": { "changed": true, "failed": false, "msg": "Finished running script /home/ansible/Compliance.sql \nContents: \nselect username from dba_users" } }

tdavison784 commented 4 years ago

Hi,

the oracle_sql script param does not allow select statement at this time. If you refer to the oracle_sql documentation on line(s) 45 - 48 you can see the note regarding this.

script: description:

The work around is to use the sql param instead of script param for select statements.

On Sat, Jan 25, 2020 at 8:52 AM anandsolomon notifications@github.com wrote:

Hi, I am trying to run a sql script which has simple select statement. (select username from dba_users). Will oracle_sql module run a "Select" statement and returns the results ?

I am getting "{"changed": false, "msg": "Something went wrong while executing sql - ORA-00972: identifier is too long sql: "Finished running script /home/ansible/Compliance.sql \nContents: \nselect username\n \ from dba_users""}

The debug output is as below:

TASK [Display the query results]


ok: [22.174.101.30] => (item=msg.stdout) => { "msg": { "changed": true, "failed": false, "msg": "Finished running script /home/ansible/Compliance.sql \nContents: \nselect username from dba_users" } }

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/oravirt/ansible-oracle-modules/issues/125?email_source=notifications&email_token=AHY4VPZEW3ZLLLQTAMVCBHDQ7RG3ZA5CNFSM4KLRG5B2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIWCB4Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHY4VP4SPZ7MZXCH4FXS7UDQ7RG3ZANCNFSM4KLRG5BQ .

anandsolomon commented 4 years ago

Thanks very much