Skip to content

Instantly share code, notes, and snippets.

@mortenbra
Created March 14, 2018 19:46
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 mortenbra/443e3270dca1aeac410e93b941cb8593 to your computer and use it in GitHub Desktop.
Save mortenbra/443e3270dca1aeac410e93b941cb8593 to your computer and use it in GitHub Desktop.
Visual Studio Code PL/SQL snippets
{
/*
// Place your snippets for PLSQL here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"Write to application log": {
"prefix": "log",
"body": [
"appl_log_pkg.log_debug(l_log_event, '$1');",
"$2"
],
"description": "Write to application log table"
}
,
"cursor for loop": {
"prefix": "forl",
"body": [
"for ${1:l_rec} in ${2:l_cursor} loop",
" $0;",
"end loop;"
],
"description": "Cursor for loop"
}
,
"select into": {
"prefix": "selinto",
"body": [
"begin",
" select $1",
" into l_returnvalue",
" from $2",
" where $2_id = p_$2_id;",
"exception",
" when no_data_found then",
" l_returnvalue := null;",
"end;",
"$0"
],
"description": "Cursor for loop"
}
,
"function": {
"prefix": "func",
"body": [
"function $1 ($2) return $3",
"as",
" l_returnvalue $3;",
"begin",
"",
" $0",
"",
" return l_returnvalue;",
"",
"end $1;",
""
],
"description": "Function"
}
,
"procedure": {
"prefix": "proc",
"body": [
"procedure $1 ($2)",
"as",
"begin",
"",
" $0",
"",
"end $1;",
""
],
"description": "Function"
}
,
"Comment block": {
"prefix": "comment",
"body": [
"/*",
"",
"Purpose: $1",
"",
"Remarks: $2",
"",
"Who Date Description",
"------ ---------- --------------------------------",
"MBR $3.$4.2018 Created",
"",
"*/",
"",
"$0"
],
"description": "Standard comment block"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment