createPROCEDURE {pgTools} | R Documentation |
Generate a PostgreSQL CREATE PROCEDURE statement, optionally execute the statement if con is not NULL.
Description
Generate a PostgreSQL CREATE PROCEDURE statement, optionally execute the statement if con is not NULL.
Usage
createPROCEDURE(
name,
args = NULL,
or_replace = FALSE,
language = "SQL",
definition,
con = NULL
)
Arguments
name |
A string, the "name" parameter for PostgreSQL CREATE PROCEDURE. |
args |
A named list, names are the argument names, values are strings with the argument data types. |
or_replace |
TRUE/FALSE, if TRUE, adds "OR REPLACE" to PostgreSQL CREATE PROCEDURE statement. |
language |
A string, the "language" parameter for PostgreSQL CREATE PROCEDURE. |
definition |
A string, the "definition" parameter for PostgreSQL CREATE PROCEDURE. |
con |
A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery. |
Value
A string, PostgreSQL CREATE PROCEDURE statement; or the results retrieved by DBI::dbSendQuery after executing the statement.
Examples
createPROCEDURE(
name = "sample",
args = list(a = "INTEGER", b = "TEXT"),
definition = "INSERT INTO tbl(col1, col2) VALUES (a, b);"
)
[Package pgTools version 1.0.2 Index]