Execute code of procedure

I'm using the last version  DBE.

My data base is DB2.

Tell me please: how to put in the terminating code?

All the matter is, if the procedure have a few statements and the terminating ";" then the code of the procedure is
executed just before this statement. After this there is an error END-OF-STATEMENT and code does not execute.

Tool from DB2 developers supports the end of procedure symbol choice.
It would be nice to have this option included.
If such option exists, please let me know how to enable it.

FYI: The same situation with function.

0
3 comments

Can you provide a code sample that fails? I'm not an expert in DB2 procedures, but I tried the following dummy code, and it executes successfully (I tried it in console):

create function dummy_function() returns integer language sql
begin
  declare v1 int default 10;
  set v1 = v1 + 2;
  return v1;
end;
select dummy_function() from dummy_table;


Regards,
Alexander.

0
Avatar
Permanently deleted user
 
For example:
  
CREATE OR REPLACE PROCEDURE TEST.name()
LANGUAGE SQL
BEGIN
   DECLARE
v_perem1 INTEGER;
   SET v_perem1 = 2;
   DECLARE GLOBAL TEMPORARY TABLE tt_tab1
   (
      col1 INTEGER,
      col2 INTEGER
   
)  on commit preserve rows not logged with replace;
   begin
      DECLARE
SWV_cursor_var CURSOR WITH RETURN FOR select SESSION.tt_tab1.col1, SESSION.tt_tab1.col2 FROM SESSION.tt_tab1 WHERE v_perem1 between col1  and col2;
      OPEN SWV_cursor_var;
   end;
END



Need  select the entire code and in the context menu select Execute Selection.
But in this case if there is an error in the code is difficult to determine exactly where it is.
Line number where is located error dosn not return.

0

Thank you. I've reproduce the problem and created the request: http://youtrack.jetbrains.com/issue/DBE-838

Without "WITH REPLACE" clause the code is executed normally on my side. (It's just a diagnostic, not a suggestion to remove the clause.)

However, if you meet other issues, welcome to report them too.

Regards,
Alexander.

0

Please sign in to leave a comment.