Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

oracle search

Wednesday, August 6, 2008

Competition ....oracle

Well, not really a competition because we haven't got any prizes to give away, but the code below (thanks Padders) has a real "How Many WTFs Can You Spot?" feel about it. I make it four.

PROCEDURE log_error
( p_source IN VARCHAR2
, p_result IN VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
p_primarykey errorlogging.primarykey%TYPE;
BEGIN
SELECT errorlogging_seq.NEXTVAL
INTO p_primarykey
FROM dual;

INSERT /*+ APPEND */ INTO errorlogging NOLOGGING
( primarykey
, source
, result
, timestamp
, wherewasi
, processed_count
, process_id )
VALUES
( p_primarykey
, p_source
, SUBSTR(p_result, 1, 1000)
, SYSDATE
, NULL
, NULL
, 1 );

COMMIT;
EXCEPTION
WHEN OTHERS THEN NULL;
END;

No comments: