set serveroutput on
declare
v_ts timestamp ;
begin
select systimestamp into v_ts from dual;
dbms_output.put_line('Select has been done at ' || V_ts);
end;
I get error ORA-00922 missing or invalid option.
On the input screen it is asking: enter anonymous block with integer bind variable named :result(true=1). What are they asking?
If you want to use an actionable query, the idea is that if the SQL (or pl/sql) returns true, then the automation will continue, but if it returns false, it will stop.
Based on what I see in your SQL, you just want to run a query. Maybe an "Execute script" action would better suit your needs here.
Yes I did run it as an “Execute Script” without any issue. But I thought this was another option.
Could you provide an example where you could use Actionable Query to run an anonymous pl/sql. I would like to see if I could then use it for something else.
Thank You very much,
Jim Sniatecki
Toad for Oracle Instructor
Yeah, that will work, but I think you're misunderstanding the purpose of the actionable query.
It's not to just run some SQL. It's to run a SQL in order to make a yes/no decision about if the next actions in the app will run or not. Think of it as an if..then.
if (actionable query returns true) then
do other actions
else
stop.
If all you want to do is run SQL, you can use an "Execute script" action (on the DB Misc tab) for that.
Thank you.
If you can provide me with a real world type example I would appreciate it. I can use my example for a class but I don’t know if it is realistic.
Well, I think "Real world" depends on your business needs, but as an example, you could use it to see if a specific value exists in a table before exporting it, then only export if the value is present.
In this video I'm using AD in the SQL mode instead of PLSQL mode.
John, thank you for your great support in my AQ issue.
Here is what I think may be a good class example. The purpose is to ,on session logon,
record the start SCN in case the developer may need to do a flashback table operation.
Here is the query I used and it runs successfully.
DECLARE
v_scn integer ;
v_ts timestamp ;
BEGIN
select systimestamp, timestamp_to_scn(systimestamp) into v_ts, v_scn from dual;
:result :=1;
insert into student.session_start_scn(start_ts,start_scn)
values(v_ts,v_scn);
commit;
END;
Forgot to mention , I included the app to run in their session logon. The app executes and returns the message app successfully completed and the table is updated.
John, first of all I can't thank you enough for the AD enlightenment. I really get it now.
So I put this example together for my TOAD class:
Say a developer wants to signon each morning to a development app and on sigon wants to check to see if a table has been
updated (insert,update, or delete) by executing an Automation Designer app with an Actionable Query and an export dataset to keep
a current backup of it.
The table (e.g. student.empad) has been created with the rowdependencies feature of Oracle.
This means anytime a row gets changed , its ora_rowscn gets updated.
If this returns TRUE then export the table, if false then fail and don't export.
EXISTS (select 1 from student.empad
where to_char(sysdate-1,'ddmmyyyy') =
to_char(scn_to_timestamp(ora_rowscn),'ddmmyyyy'));