Skip to content

Instantly share code, notes, and snippets.

@booyaa
Created July 26, 2013 11:20
Show Gist options
  • Save booyaa/6088122 to your computer and use it in GitHub Desktop.
Save booyaa/6088122 to your computer and use it in GitHub Desktop.
oracle stored proc development workflow

##sketch

SET SERVEROUTPUT ON

DECLARE
  V_CURSOR      FOO_REFCUR;
  V_ROW         FOO%ROWTYPE;
  V_TIMESTAMP   VARCHAR2(200);  
  V_REC_COUNT INT; 
  
BEGIN
  -- do we need to pre-populate a table?
  SELECT COUNT(*) INTO V_REC_COUNT FROM BAR;
  
  -- everyone loves a bit of debug
  DBMS_OUTPUT.PUT_LINE('Records in table: ' || V_REC_COUNT);  
  
  IF V_REC_COUNT = 0 THEN
    DBMS_OUTPUT.PUT_LINE('do shit!');
  ELSE
    DBMS_OUTPUT.PUT_LINE('do something else instead');
  END IF;  
END;

##transfer to sproc

include code here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment