util
dev.to·12w·
Discuss: DEV
-- util.sql
SET SERVEROUTPUT ON
SET ECHO OFF
SET FEEDBACK OFF
WHENEVER SQLERROR EXIT SQL.SQLCODE

-- Error checker (silent unless errors exist)
CREATE OR REPLACE PROCEDURE CHECK_ERRORS(p_name VARCHAR2, p_type VARCHAR2) AS
v_cnt INTEGER;
BEGIN
SELECT COUNT(*) INTO v_cnt
FROM user_errors
WHERE name = UPPER(p_name)
AND type = UPPER(p_type);

IF v_cnt > 0 THEN
FOR r IN (
SELECT line, position, text
FROM user_errors
WHERE name = UPPER(p_name)
AND type = UPPER(p_type)
ORDER BY sequence
) LOOP
DBMS_OUTPUT.PUT_LINE('Line ' || r.line || ': ' || r.text);
END LOOP;

RAISE_APPLICATION_ERROR(-20001, 'Compilation failed.');
END IF;
END;
/
SHOW ERRORS PROCEDURE CHECK_ERRORS


--------------------------------------------------------------------------------
-- FUNCTION example
-------------------------...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help