-- Пачка 5.5. Те же кейсы, что на стенде: вывод Java в трассу.
|
CREATE OR REPLACE PROCEDURE dbms_java_enable_output_to_trc()
|
AS 'dbms_java_enable_output_to_trc' LANGUAGE internal;
|
CREATE OR REPLACE PROCEDURE dbms_java_disable_output_to_trc()
|
AS 'dbms_java_disable_output_to_trc' LANGUAGE internal;
|
CREATE OR REPLACE FUNCTION dbms_java_query_output_to_trc() RETURNS varchar2
|
AS 'dbms_java_query_output_to_trc' LANGUAGE internal;
|
DO $$
|
DECLARE
|
msg text;
|
BEGIN
|
RAISE NOTICE 'Expected: Output to trc is enabled';
|
msg := dbms_java_query_output_to_trc();
|
RAISE NOTICE 'Actual: %', COALESCE(replace(replace(msg, chr(10), '|'), chr(13), ''), 'NULL');
|
END $$;
|
NOTICE: Expected: Output to trc is enabled
|
NOTICE: Actual: Output to trc is enabled
|
DO $$
|
DECLARE
|
msg text;
|
BEGIN
|
RAISE NOTICE 'Expected: ok|Output to trc is disabled';
|
BEGIN
|
CALL dbms_java_disable_output_to_trc();
|
msg := 'ok';
|
EXCEPTION WHEN OTHERS THEN
|
msg := SQLERRM;
|
END;
|
msg := msg || '|' || COALESCE(replace(replace(dbms_java_query_output_to_trc(), chr(10), '|'), chr(13), ''), 'NULL');
|
RAISE NOTICE 'Actual: %', msg;
|
END $$;
|
NOTICE: Expected: ok|Output to trc is disabled
|
NOTICE: Actual: ok|Output to trc is disabled
|
DO $$
|
DECLARE
|
msg text;
|
BEGIN
|
RAISE NOTICE 'Expected: ok|Output to trc is enabled';
|
BEGIN
|
CALL dbms_java_enable_output_to_trc();
|
msg := 'ok';
|
EXCEPTION WHEN OTHERS THEN
|
msg := SQLERRM;
|
END;
|
msg := msg || '|' || COALESCE(replace(replace(dbms_java_query_output_to_trc(), chr(10), '|'), chr(13), ''), 'NULL');
|
RAISE NOTICE 'Actual: %', msg;
|
END $$;
|
NOTICE: Expected: ok|Output to trc is enabled
|
NOTICE: Actual: ok|Output to trc is enabled
|
CALL dbms_java_enable_output_to_trc();
|