5. Working with a Database : How Programming for Multiple Sessions Works : How You Can Switch Database Sessions : How You Can Switch Sessions for 3GL and Database Procedures
 
Share this page                  
How You Can Switch Sessions for 3GL and Database Procedures
To use 4GL code to switch the session for a 3GL procedure, you must do so before you call the procedure. For example, the following code could appear in an event block:
on click add =
begin
    CurFrame.DBSession = second_session;
    status = callproc check_name
            (name = cus_name);
    CurFrame.DBSession = first_session;
end;
You can use Embedded SQL to switch sessions within a 3GL procedure. However, when the procedure completes and control returns to OpenROAD, the application automatically returns to the session in which it was running when the procedure was called.
You cannot switch sessions within a database procedure. If you want the tasks in a database procedure to be performed in a different session, you must change the session before you call the procedure.