SQLProcedures
SQLProcedures#
SQLProcedures returns the list of procedure names stored in a specific database. Procedure is a generic term used to describe an executable object, or a named entity that can be invoked using input and output parameters.
SQLProceduresW() as a Unicode string supports same execution as SQLProcedures().
Syntax#
SQLRETURN SQLProcedures (
SQLHSTMT stmt,
SQLCHAR * cName,
SQLSMALLINT cNameLength,
SQLCHAR * sName ,
SQLSMALLINT sNameLength,
SQLCHAR * pName,
SQLSMALLINT pNameLength );
Arguments#
Data Type | Argument | In/Out | Description |
---|---|---|---|
SQLHSTMT | stmt | Input | Statement handle |
SQLCHAR * | cName | Input | Procedure catalog name |
SQLSMALLINT | cNameLength | Input | The length, in bytes, of *cName |
SQLCHAR * | sName | Input | Procedure schema name |
SQLSMALLINT | sNameLength | Input | The length, in bytes, of *sName |
SQLCHAR * | pName | Input | Procedure name. Cannot be a NULL pointer. pName must not contain the string search-patterns. |
SQLSMALLINT | pNameLength | Input | The length, in bytes, of *pName |
Return Values#
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_INVALID_HANDLE
SQL_ERROR
Description#
SQLProcedures() displays the list of all procedures in the required range. A user may have or have not a privilege to use and execute these procedures.
SQLProcedures() returns the results in the format of the standard result set format sorted in order by PROCEDURE_CAT, PROCEDURE_SCHEM, and PROCEDURE_NAME.
SQLProcedures() may not return all procedures. An application can use the valid procedures whether the procedure is returned by SQLProcedures() or not.
Name | No. | Data Type | Description |
---|---|---|---|
PROCEDURE_CAT | 1 | VARCHAR | Procedure catalog identifier NULL if not applicable to the database |
PROCEDURE _SCHEM | 2 | VARCHAR | Procedure schema identifier; NULL if not applicable to the database |
PROCEDURE _NAME | 3 | VARCHAR (NOT NULL) | Procedure identifier |
NUM_INPUT_PARAMS | 4 | N/A | Reserved for future use. An application must not apply any returned data to this result string. |
NUM_OUTPUT_PARAMS | 5 | N/A | Reserved for future use. An application must not apply any returned data to this result string. |
NUM_RESULT_SETS | 6 | N/A | Reserved for future use. An application must not apply any returned data to this result string. |
REMARKS | 7 | VARCHAR | Procedure description |
PROCEDURE_TYPE | 8 | SMALLINT | Definition of the procedure type - SQL_PT_UNKNOWN: It cannot be determined whether the procedure returns a value. - SQL_PT_PROCEDURE: The returned object is a procedure. that is, it does not have a return value. - SQL_PT_FUNCTION: The returned object is a function. that is, it has a return value. |
[Table 2‑4] The Column Returned by SQLProcedures()
Diagnosis#
SQLSTATE | Description | Comments |
---|---|---|
08S01 | Communication channel error | Communication channel failure before the function processing is completed between the Altibase CLI driver and the database |
HY000 | General error | |
HY009 | Invalid arguments used (null pointer) | CName is a NULL pointer sNme, pName are NULL pointer |
Related Functions#
SQLBindCol
SQLFetch
SQLProcedureColumns
Example#
< Refer to: $ALTIBASE_HOME/sample/SQLCLI/demo_meta5.cpp >
if (SQLProcedures(stmt,
NULL, 0,
NULL, 0,
NULL, 0) != SQL_SUCCESS)
{
execute_err(dbc, stmt, "SQLProcedures");
SQLFreeStmt(stmt, SQL_DROP);
return SQL_ERROR;
}