I have a process flow built by someone prior which calls a very simple stored procedure. upon completion of the procedure the process flow has 2 transitions, one if the stored procedure was successful and the other if not. However, the stored procedure itself does not return anything that can be directly evaluated by the process flow like a return result. Now this procedure if it fails (with the ubiquitious max extants problem) it will call the branch which will call a stored procedure for sending a failure email message. If it succeeds the contrary will occur.
I had to tweak the procedure so I created a new one. now if it fails or succeeds the success branch is called regardless. I have checked all the docs from oracle as to how to make this work and for the life of me cannot determine how to make it work correctly. I first posted this on the oracle forum and got no responses. Does anyone have an idea how to make this work?
According to the Oracle Warehouse Builder guide:
When you add a transition to the canvas, by default, the transition has no condition applied to it.
Make sure that you have correctly defined a conditional transition as described in the Defining Transition Conditions section of the documentation.
A User Defined Activity will return an ERROR outcome if:
it raises an exception, or
it returns the value 3 and the Use Return as Status option is set to true
"However, the stored procedure itself does not return anything that
can be directly evaluated by the process flow like a return result."
This is the crux: if the operating procedure procedure produces no signal how can you tell whether it was successful? Indeed, what is the definition of success under this circumstance?
I don't understand why, when you had to "tweak the procedure", you wrote a new one instead of, er, tweaking the original procedure. The only way you're going to solve this is to get some feedback out of the original procedure.
At this point we run out of details. The direct option is to edit the original procedure so it passes back result info, probably through OUT parameters or else by introducing some logging capability. Alternatively, re-write it to raise an exception on failure. The indirection option is to write some queries to establish what the procedure achieved on a given run, and then figure out whether that constitutes success.
Personally, re-writing the original procedure seems the better option.
If this answer doesn't help you then you need to explain more about your scenario. What your procedure does, how you need to evaluate it, why you can't re-write it.
Related
Currently there is one place in our code that uses RAISE_APPLICATION_ERROR:
IF v_cl_type_row.code = 'B_DOCUMENT' THEN
RAISE_APPLICATION_ERROR(-20000, '*A message for the user*');
END IF;
It's not an error that happens here, the user just gets an informational message. Because this is currently raised as an error, it is then also logged as an error, which it is not. So I have been tasked with somehow returning this as an info message instead, to avoid unnecessary logging.
But is that even possible with Oracle inbuilt functions? I haven't been able to find a way how to do something like that.
We are using Oracle 19c.
IF-THEN-ELSE means PL/SQL. Code written in that language are executed within the database. PL/SQL isn't "interactive".
If you use a tool like SQL*Plus (command line) or GUI (such as SQL Developer, TOAD, etc.) you could use DBMS_OUTPUT.PUT_LINE instead of RAISE_APPLICATION_ERROR because - as you already noticed - RAISE stops the execution; user sees the message, but there's nothing they can do to make the procedure continue its work.
In your example, it would be
IF v_cl_type_row.code = 'B_DOCUMENT' THEN
DBMS_OUTPUT.PUT_LINE('*A message for the user*');
END IF;
Note that you'd have to wait until procedure finishes to see all messages at once; Oracle won't display them one-by-one, as code reaches that point.
However, as far as it is OK to use for debugging purposes, users most probably don't use any of tools I previously mentioned. If it were e.g. Oracle Forms application or Apex one, that code would work (i.e. wouldn't raise a compilation error), but nobody would see anything because these front-ends aren't capable of displaying such a message.
In Forms, for example, you could use message built-in (text would then be displayed in the status line, at the bottom of the screen) or alert (so you'd see a pop-up window which lets you acknowledge the message and move on, i.e. code would proceed its execution).
Therefore, it depends on which tool you actually use to develop that application and its capabilities of interaction with end users.
I have an Oracle Forms 11 g application running on Weblogic server. The default form/login page has a few PL/SQL triggers that simply will not fire. The rest of the configuration seems successful.
Can anyone give me pointers as to where to start looking?? Thanks in advance.
As their name suggests, triggers fire when something triggers them. For example,
a WHEN-BUTTON-PRESSED trigger is triggered by pushing a button
a POST-QUERY trigger fires after executing a query in a data block
a WHEN-NEW-FORM-INSTANCE trigger fires when the form is being run
and so on.
Therefore, make sure that triggers really are triggered. The fact that you have them doesn't mean that they'll run, just because.
In order to find that out, you have two options:
run a form in debug mode:
in one of the triggers (for example in a WHEN-NEW-FORM-INSTANCE) set a breakpoint by right clicking its left margin (you'll see what to do next)
then run the form; that green toolbar icon you use to run it shouldn't be used, but the one next to it, with something reddish on it
as soon as execution gets to the breakpoint, it'll stop, you'll be transferred to Forms Builder, a debug console will open and will let you navigate through the rest of the code step-by-step
do that, and you'll know what's going on, i.e. whether those triggers are called and what they do
as of you being suspicious: did you, by any chance, put some exception handlers that use WHEN OTHERS THEN NULL or something similar? If so, get rid of them. Even if an exception is raised (such as NO_DATA_FOUND or TOO_MANY_ROWS, just to mention two of the most popular and frequent ones), THEN NULL will silently mask it
another one is to put MESSAGE calls into the triggers, such as
begin
message('running WBP trigger: step 1');
... the rest of your code goes here
end;
Doing so, message-after-message will raise an "alert" on the screen (as you'll have to click OK that you saw what it said), and you'll quickly see which triggers fired and which did not. Then investigate it further - debugging described previously will help.
If none of that helps, you'll have to describe what's going on, but this time providing some more info. What you wrote isn't very descriptive. Anyway, best of luck.
I am running DB queries in the UFT framework. During the execution, if the data is deleted in the backend tables, then UFT will throw the error message box as like below. I want to skip the error and continue and report the error description in the xml result sheet.
Error Message:
Run Error:
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record
I am trying to add by recovery scenario by calling error function and proceed to next step. My error function is as like below:
Function RecoveryFunction1(Object, Method, Arguments, retVal)
If err.number<>"" then
error1=err.description
Reporter.reportevent micwarning,"Error ocurred:","","Error Details: "&error1&"
End If
End Function
I have added the above function in the function library and associated the recovery scenario in the test settings. But still error message is throwing up.
Please help me to handle the error message during run time instead of writing for each and every function 'on error resume next' statement.
You need to change the way you request the view of the database so that later modifications or deletions will not affect your query.
Take a look at the docs for the ADO Recordset. It specifies different cursor types, some of which will allow you to keep a static view of the data as it was when you ran the query, while others give live views. I'm not sure which one is best for your specific use case, so you should experiment and see which one works for you.
Failing that, you can try a move heavy-handed approach which is to begin a database transaction before you do your select, which should isolate your data processing from any external changes. However, that may be undesirable if your process takes a long time, as it may lock out other processes until you end your transaction and yield the locks on the rows you're looking at. Again, it depends on your specific database environment and the systems that interact with it.
Im using Tarantool 1.5 and lua procedures.
Documentation says a lua procedure can yield execution to another after network/io operation for example, a box.update call.
My main question is: if I get return tuple from box.update does it contain information "after update, before yield" or "after update, after yield" ?
Also, what is the best-practices to prevent possible race conditions?
If you need to do something like a transaction in 1.5, you may do either idempotent operation or do re-select and checks after any yield operation (update/delete/replace)
I was wondering if there is a way how to perform actions in a function after it returning a value.
i.e there is a method which returns a string. Now after the string is returned I want the method to perform another action like checking whether a condition is met so it can send out a notification or something else. Is that somehow possible?
The thing is that I am using a framework called core plot to add some plots to my application. Unfortunately this framework does not have a didFinishAddingPlot method. So I have to manually program a mechanism which notifies me whenever the plot finished plotting. When the addPlot method is called another method is called which goes through an array of values and returns a value for a specific index to plot. My idea was to put in a "if (condition)" block to check if the index is equal to the count of my values array so I know that it is now fetching the last value. However it first needs to return the value before sending a message that it finished plotting. Otherwise the last value won't get passed.
As soon as a function hits a return statement the function stops running. You would need to perform whatever other action you want to do before you return.
So, you want to return a value from your function or method, which by definition returns control (as well as your answer) to the call site. On the face of it, it's not possible; you've returned control, so you're done.
But you could spawn a new Thread during your method execution, to (for example) perform some cleanup tasks later on.
Since you tagged the question as Cocoa, check out Apple's Threaded Programming Guide, which will teach you about NSThread, POSIX threads, and more.