on 01-23-2019 6:11 AM
select count(*) into lv_count from "****.synonyms::Src_STM" where "ID" = :user_input;
CASE WHEN lv_count > 0 THEN :user_input else "Throw an Exception" END
As well as for several other questions of you the official documentation already contains the answer to your question. Please check the documentation for the SIGNAL. Maybe at some time the point is reached when it is really worth to have a look the documentation :).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please can you share your whole procedure code.
Hi Florian,
Here is the code
PROCEDURE "a.b.c"(IN INPUT "abcd",
OUT OUTPUT "output_message",OUT EX_error_MESSAGE nvarchar(255) )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
AS
BEGIN
for i in 1..cardinality(:Id) do
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
Error_message = 'SQL Exception occured.Error Code is:'||::SQL_ERROR_CODE||'Error message is:'||::SQL_ERROR_MESSAGE;
END;
select count(*) into lv_count from table3 where…..
if abcd =” ‘’ and lv_count > 0
then
insert into table1….."
insert into table2…..
success_message = '' ||' ' ||:newid||' '|| 'created successfully';
INSERT INTO "adt_toolshed.adt_db.tables::id" VALUES (:success_message);
elseif abcd = “ '' AND lv_count = 0
RESIGNAL SET MESSAGE_TEXT = 'for the input parameter in_var = '||
:xyz[i] || ' exception was raised ';
Else
select max("VERSION") into vers FROM "table2" where "xxxxx" = :yyy
insert into table2
update table1
end if;
OUTPUT = select * from "dummy";
end for;
TRUNCATE TABLE "dummy";
END;
error :
incorrect syntax near resignal
Man, you should really be consistent. In the first comment you wrote about an error for a condition defintion, now for resignal. That makes no fun.
Regaring your 2nd version I would say that a "then" is missing after the elseif condition.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.