I have a .sql file which gets an input and runs, I should run it from a python code with some inputs, but it doesn't work. What is problem?
sql file:
declare
--define variables
v_workspace_id NUMBER;
BEGIN
select workspace_id into v_workspace_id
from apex_workspaces
where workspace = upper('&1');
DBMS_OUTPUT.PUT_LINE(v_workspace_id);
apex_application_install.set_workspace_id( v_workspace_id );
apex_application_install.generate_application_id;
apex_application_install.generate_offset;
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END;
part of python file to run this file:
cmd_sql = 'echo quit | sqlplus -S ' + DB_USER + '/' + DB_USER_PWD + '@' + DB_HOST + ' @' + SQL_PATH + '\\' + 'install_apex_apps.sql ' + user_name + ' >> ' + LOG_FILE
os.system(cmd_sql)
user_name is given as an input to sql file.
generate_application_idyour exception handler the resulting error message indicate the` raise` statement, not the point where the error occurred. Without the exception handler in would point to the line ingenerate_application_id