Skip to content

Instantly share code, notes, and snippets.

@adamcrown
Created June 28, 2012 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamcrown/3007807 to your computer and use it in GitHub Desktop.
Save adamcrown/3007807 to your computer and use it in GitHub Desktop.
Printing the results of an Oracle function
-- Must me NUMBER or CHAR if you want to print it. Printing a VARCHAR is too complex for expensive databases like Oracle.
VARIABLE r CHAR (1000);
BEGIN
-- := is for assignment. vs = for equality
-- bind variables are prefixed with a colon
-- BANIST1 is the instance
-- BSK_INFO_REQUEST is the package
-- get_prel_codes() is the function
:r := BANINST1.BSK_INFO_REQUEST.get_prel_codes();
END;
-- I don't know what this does. Stupid Oracle.
.
-- I guess this runs everything above.
run;
-- And now we can finally print the results we wanted.
-- Why can't you just do PRINT BANINST1.BSK_INFO_REQUEST.get_prel_codes();? Because it's Oracle and it's too expensive for that sort of simplicity.
PRINT :r;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment