Pervasive PSQL System Stored Procedures
Chapter contents
The system stored procedures help you accomplish those administrative and informative tasks that are not covered by the Data Definition Language. The system stored procedures have a psp_ prefix.
Note
Since the system stored procedure names use the psp_ prefix, do not create any stored procedures with the psp_ prefix. Any user-created stored procedure with the same name as that of a system stored procedure will never be executed.
The following table lists the system stored procedures currently supported.
Table 6-1 Pervasive PSQL System Stored Procedures
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Unless otherwise noted, the code examples for the system stored procedures refer to the Demodata sample database provided with Pervasive PSQL or to Pervasive PSQL system tables.
If you execute a system stored procedure in the context of a database (for example, A) and try to obtain information from a secured database (for example, B), an error message appears. You cannot obtain information from a secured database from any other database.
psp_columns
Returns the list of columns and their corresponding information for a specified table, from the current database or the specified database.
Syntax
call psp_columns(['database_qualifier'], 'table_name', ['column_
name'])
Arguments
Table 6-2 psp_columns Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
table_name
|
VARCHAR(255)
|
|
Name of the table whose column information is required
|
|
column_name
|
VARCHAR(255)
|
All columns for the specified table
|
Column name of the table specified
|
Returned Result Set
Table 6-3 psp_columns Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
TABLE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
TABLE_OWNER
|
VARCHAR (20)
|
Name of the table owner
|
|
TABLE_NAME
|
VARCHAR(255)
|
Name of the table
|
|
COLUMN_NAME
|
VARCHAR(255)
|
Column name of the table
|
|
DATA_TYPE
|
SMALLINT
|
Data type of the column (as stored in the database)
|
|
TYPE_NAME
|
VARCHAR (32)
|
Name of the data type of the column corresponding to DATA_TYPE value
|
|
PRECISION
|
INTEGER
|
The precision of the column if the data type of the column is Decimal, Dec etc.
|
|
LENGTH
|
INTEGER
|
The length of the column, if the data type of the column is Char, Character etc.
|
|
SCALE
|
SMALLINT
|
The scale of the column if the data type of the column is Decimal, Dec etc.
|
|
RADIX
|
SMALLINT
|
Base for numeric data types
|
|
NULLABLE
|
SMALLINT
|
Specifies nullability:
1 - NULL
0 - NOT NULL
|
|
REMARKS
|
VARCHAR(255)
|
Remarks field
|
Examples
create table tx (c_binary BINARY(10),
c_char CHAR(10),
c_tinyint TINYINT,
c_smallint SMALLINT,
c_int INT,
c_bigint BIGINT,
c_utinyint UTINYINT)
call psp_columns(, 'tx',)
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Data_type
|
Type_name
|
P
|
L
|
S
|
R
|
N
|
R
|
|
'demodata'
|
Null
|
tx
|
C_binary
|
-2
|
Binary
|
10
|
10
|
Null
|
Null
|
1
|
Null
|
|
'demodata'
|
Null
|
tx
|
C_char
|
-1
|
Char
|
10
|
10
|
Null
|
Null
|
1
|
Null
|
|
'demodata'
|
Null
|
tx
|
C_tinyint
|
-6
|
Tinyint
|
3
|
1
|
0
|
10
|
1
|
Null
|
|
.....
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend: P = Precision; L = Length; S = Scale; R = Radix; N = Nullable; R = Remarks
|
call psp_columns('wsrde, 'tx', )
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Data_type
|
Type_name
|
P
|
L
|
S
|
R
|
N
|
R
|
|
'wsrde'
|
Null
|
tx
|
C_binary
|
-2
|
Binary
|
10
|
10
|
Null
|
Null
|
1
|
Null
|
|
'wsrde'
|
Null
|
tx
|
C_char
|
-1
|
Char
|
10
|
10
|
Null
|
Null
|
1
|
Null
|
|
'wsrde'
|
Null
|
tx
|
C_tinyint
|
-6
|
Tinyint
|
3
|
1
|
0
|
10
|
1
|
Null
|
|
.....
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend: P = Precision; L = Length; S = Scale; R = Radix; N = Nullable; R = Remarks
|
call psp_columns('wsrde, 'tx', 'c_binary')
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Data_type
|
Type_name
|
P
|
L
|
S
|
R
|
N
|
R
|
|
'wsrde'
|
Null
|
tx
|
C_binary
|
-2
|
Binary
|
10
|
10
|
Null
|
Null
|
1
|
Null
|
|
Legend: P = Precision; L = Length; S = Scale; R = Radix; N = Nullable; R = Remarks
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string.
- If table_name is null, the following error message appears:
Table name cannot be null.
- If table_name is a blank string, the following error message appears:
Table name cannot be a blank string.
- If column_name is a blank string, the following error message appears:
Column name cannot be a blank string.
psp_column_attributes
Returns the list of column attributes and the corresponding information from the current database or the specified database.
Syntax
call psp_column_attributes(['database_qualifier'], ['table_name'],
['column_name'])
Arguments
Table 6-4 psp_column_attributes Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
table_name
|
VARCHAR(255)
|
All the tables
|
Name of the table whose column information is required
|
|
column_name
|
VARCHAR(255)
|
All columns for the specified table
|
Column name of the table specified
|
Returned Result Set
Table 6-5 psp_column_attributes Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
TABLE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
TABLE_OWNER
|
VARCHAR (20)
|
Name of the table owner
|
|
TABLE_NAME
|
VARCHAR(255)
|
Name of the table
|
|
COLUMN_NAME
|
VARCHAR(255)
|
Column name of the table
|
|
ATTRIB_TYPE
|
CHAR(10)
|
"Default" if a default value has been assigned to the column
|
|
ATTRIB_SIZE
|
USMALLINT
|
Size of the column attribute
|
|
ATTRIB_VALUE
|
LONGVARCHAR
|
Value of the column attribute
|
Examples
create table tx (c_binary binary (10) default 01,
c_char char (11) default 'thisisatest',
c_tinyint TINYINT,
c_SMALLINT SMALLINT,
c_int INT,
c_bigint BIGINT,
c_utinyint uTINYINT)
call psp_column_attributes(, , )
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Attrib_Type
|
Attrib_Size
|
Attrib_Value
|
|
'demodata'
|
Null
|
tx
|
C_binary
|
Default
|
|
01
|
|
'demodata'
|
Null
|
tx
|
C_char
|
Default
|
11
|
'Thisisatest'
|
|
.....
|
|
|
|
|
|
|
call psp_column_attributes('wsrde', , )
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Attrib_Type
|
Attrib_Size
|
Attrib_Value
|
|
'wsrde'
|
Null
|
Test
|
C_binary
|
Default
|
|
01
|
|
'wsrde'
|
Null
|
Test
|
C_char
|
Default
|
11
|
'Thisisatest'
|
|
.....
|
|
|
|
|
|
|
call psp_column_attributes(, 'tx', 'c_binary')
Result Set
|
Table_ qualifier
|
Table_owner
|
Table_name
|
Column_name
|
Attrib_Type
|
Attrib_Size
|
Attrib_Value
|
|
'demodata'
|
Null
|
tx
|
C_binary
|
Default
|
|
01
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string.
- If table_name is a blank string, the following error message appears:
Table name cannot be a blank string.
- If column_name is a blank string, the following error message appears:
Column name cannot be a blank string.
psp_column_rights
Returns the list of column rights and corresponding information for the specified table, from the current database or the specified database.
Note
This system stored procedure returns the list of column rights only if it has been explicitly specified using the GRANT syntax.
Syntax
call psp_column_rights(['database_qualifier'], 'table_name',
['column_name'], ['user_name'])
Arguments
Table 6-6 psp_column_rights Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
table_name
|
VARCHAR(255)
|
|
Name of the table for which rights have been specified
|
|
column_name
|
VARCHAR(255)
|
All columns of the specified table
|
Name of the column whose rights are to be obtained
|
|
user_name
|
VARCHAR(255)
|
All users
|
Name of the user for whom the list of column rights need to be obtained
|
Returned Result Set
Table 6-7 psp_column_rights Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
TABLE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
TABLE_OWNER
|
VARCHAR (20)
|
Name of the owner of the table
|
|
USER_NAME (GRANTEE)
|
VARCHAR(255)
|
Name of the user
|
|
TABLE_NAME
|
VARCHAR(255)
|
Name of the table
|
|
COLUMN_NAME
|
VARCHAR(255)
|
Name of the column for which the different rights have been granted
|
|
RIGHTS
|
VARCHAR(12)
|
One of the following values:
SELECT
UPDATE
INSERT
|
Examples
GRANT SELECT(Name, Building_Name)
GRANT UPDATE(Name)
GRANT INSERT(Building_Name)
Call psp_column_rights(,'Department', ,)
Result Set
|
Table_Qualifier
|
Table_owner
|
User_name
|
Table_name
|
Column_name
|
Rights
|
|
Demodata
|
Null
|
John
|
Department
|
Name
|
SELECT
|
|
Demodata
|
Null
|
John
|
Department
|
Building_name
|
SELECT
|
|
Demodata
|
Null
|
John
|
Department
|
Building_name
|
INSERT
|
|
Demodata
|
Null
|
Mary
|
Department
|
Name
|
UPDATE
|
|
.....
|
|
|
|
|
|
call psp_column_rights ('demodata', 'department',
'name',)
Result Set
|
Table_Qualifier
|
Table_owner
|
User_name
|
Table_name
|
Column_name
|
Rights
|
|
Demodata
|
Null
|
John
|
Department
|
Name
|
SELECT
|
|
Demodata
|
Null
|
Mary
|
Department
|
Name
|
UPDATE
|
call psp_column_rights('demodata', 'department', ,
'mary')
Result Set
|
Table_Qualifier
|
Table_owner
|
User_name
|
Table_name
|
Column_name
|
Rights
|
|
Demodata
|
Null
|
Mary
|
Department
|
Name
|
UPDATE
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string
- If column_name is a blank string, the following error message appears:
Column name cannot be a blank string.
- If user_name is a blank string, the following error message appears:
User name cannot be a blank string.
psp_fkeys
Returns the foreign key information for the specified table, from the current database or the specified database.
Syntax
call psp_fkeys(['table_qualifier'], 'pkey_table_name', ['fkey_table_
name'])
Arguments
Table 6-8 psp_fkeys Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
table_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
pkey_table_name
|
VARCHAR(255)
|
All the tables
|
Name of the table whose foreign key is associated with the primary key column
|
|
fkey_table_name
|
VARCHAR(255)
|
All the tables
|
Name of the table whose foreign key information needs to be obtained
|
Returned Result Set
Table 6-9 psp_fkeys Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
PKTABLE_QUALIFIER
|
VARCHAR (20)
|
Database name of the primary key table
|
|
PKTABLE_OWNER
|
VARCHAR (20)
|
Name of the owner of the primary key table
|
|
PKTABLE_NAME
|
VARCHAR(255)
|
Name of the primary key table
|
|
PKCOLUMN_NAME
|
VARCHAR(255)
|
Column name of the primary key column.
|
|
KEY_SEQ
|
USMALLINT
|
Sequence of Keys
|
|
FKTABLE_QUALIFIER
|
VARCHAR (20)
|
Database name of the foreign key table
|
|
FKTABLE_OWNER
|
VARCHAR (20)
|
Name of the owner of the foreign key table
|
|
FKTABLE_NAME
|
VARCHAR(255)
|
Name of the foreign key table
|
|
FKCOLUMN_NAME
|
VARCHAR(255)
|
Column name of the foreign key column.
|
|
UPDATE_RULE
|
Utinyint
|
Update Rule
|
|
DELETE_RULE
|
Utinyint
|
Delete Rule
|
|
PK_NAME
|
VARCHAR(255)
|
Name of the primary key
|
|
FK_NAME
|
VARCHAR(255)
|
Name of the foreign key
|
Examples
CREATE TABLE Employee
(
Id INTEGER NOT NULL,
Name VARCHAR(50) NOT NULL,
SupId INTEGER NOT NULL
)
ALTER TABLE Employee
ADD CONSTRAINT EmpPkey
PRIMARY KEY(Id)
ALTER TABLE Employee
ADD CONSTRAINT ForgnKey
FOREIGN KEY(SupId) REFERENCES
Employee(Id) ON DELETE CASCADE
...
call psp_fkeys(,'Employee',)
Result Set
|
PkQ
|
PkO
|
PkT
|
PkCol
|
Seq
|
FkQ
|
FkO
|
FkT
|
FkCol
|
UR
|
DR
|
PK
|
FK
|
|
Demodata
|
Null
|
Employee
|
Id
|
0
|
Demodata
|
Null
|
Employee
|
Supid
|
1
|
2
|
EmpPkey
|
ForgnKey
|
|
Legend: PkQ = Pkey_ table_ qualifier; PkO = Pkey_table_owner; PkT = Pktable_ name; PkCol = Pk_ column_ name; Seq = Key_seq; FkQ = Fktable_qualifier; FkO = Fktable_owner; FkT = Fktable_name; FkCol = Fkcolumn_name; UR = Update_rule; DR = Delete_rule; Pk = Pk_ name; FK = Fk_ name
|
call psp_fkeys('wsrde', 'Employee','Employee')
Result Set
|
PkQ
|
PkO
|
PkT
|
PkCol
|
Seq
|
FkQ
|
FkO
|
FkT
|
FkCol
|
UR
|
DR
|
PK
|
FK
|
|
wsrde
|
Null
|
Employee
|
Id
|
0
|
wsrde
|
Null
|
Employee
|
Supid
|
1
|
2
|
EmpPkey
|
ForgnKey
|
|
Legend: PkQ = Pkey_ table_ qualifier; PkO = Pkey_table_owner; PkT = Pktable_ name; PkCol = Pk_ column_ name; Seq = Key_seq; FkQ = Fktable_qualifier; FkO = Fktable_owner; FkT = Fktable_name; FkCol = Fkcolumn_name; UR = Update_rule; DR = Delete_rule; Pk = Pk_ name; FK = Fk_ name
|
Error Conditions
- If table_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string.
- If pKey_table_name is a blank string, the following error message appears:
Primary Key table name cannot be a blank string.
- If pKey_table_name is null, the following error message appears:
Primary Key table name cannot be null.
- If fKey_table_name is a blank string, the following error message appears:
Foreign Key table name cannot be a blank string.
psp_groups
Returns the list of groups and the corresponding information from the current database or the specified database.
Syntax
call psp_groups(['database_qualifier'], ['group_name'])
Arguments
Table 6-10 psp_groups Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
group_name
|
VARCHAR(255)
|
All groups
|
Name of the group used to return group information. Pattern matching is supported.
|
Returned Result Set
Table 6-11 psp_groups Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
DATABASE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
GROUP_ID
|
USMALLINT
|
Group Id
|
|
GROUP_NAME
|
VARCHAR (255)
|
Name of the group
|
Examples
Result Set
|
Database_qualifier
|
Group_Id
|
Group_Name
|
|
Demodata
|
1
|
DevGrp
|
|
Demodata
|
2
|
DevGrp1
|
|
Demodata
|
1
|
DevGrp
|
|
.....
|
|
|
call psp_groups('Demodata', 'DevGrp1)
Result Set
|
Database_qualifier
|
Group_Id
|
Group_Name
|
|
Demodata
|
2
|
DevGrp1
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string
- If group_name is a blank string, the following error message appears:
Group name cannot be a blank string.
psp_help_sp
Returns the definition text of a given stored procedure from the current database or the specified database.
Syntax
call psp_help_sp('[database_qualifier'], 'procedure_name')
Arguments
Table 6-12 psp_help_sp - Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
procedure_name
|
CHAR(255)
|
|
Name of the procedure whose definition text is required. Pattern matching is not supported.
|
Returned Result Set
Table 6-13 psp_help_sp - Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
DATABASE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
SP_TEXT
|
LONGVARCHAR
|
Stored procedure definition text
|
Examples
call psp_help_sp(, 'Myproc')
Result Set
|
Database_Qualifier
|
SP_TEXT
|
|
Demodata
|
Create procedure Myproc(:a integer,
OUT :b integer) as
Begin
Set :a = :a + 10;
Set :b = :a;
End
|
call psp_help_sp('wsrde', 'Myproc1')
Result Set
|
Database_Qualifier
|
SP_TEXT
|
|
wsrde
|
Create procedure Myproc1(:a integer)
returns (name char(20))
as
Begin
Select name from employee where Id
=:a;
End
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string"
- If procedure_name is a blank string, the following error message appears:
Procedure name cannot be a blank string.
- If procedure_name is null, the following error message appears:
Procedure name cannot be null.
psp_help_trigger
Returns the definition text of a trigger from the current database or the specified database.
Syntax
call psp_help_trigger (['database_qualifier'], 'trigger_name')
Arguments
Table 6-14 psp_help_trigger - Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
trigger_name
|
VARCHAR(255)
|
|
Name of the trigger whose definition text is to be returned.
|
Returned Result Set
Table 6-15 psp_help_trigger - Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
DATABASE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
TRIGGER_TEXT
|
LONGVARCHAR
|
Trigger definition text.
|
Examples
The following statement prints the definition of the 'MyInsert' trigger:
CREATE TABLE A
(
col1 INTEGER,
col2 CHAR(255)
) ;
CREATE TABLE B
(
col1 INTEGER,
col2 CHAR(255)
) ;
CREATE TRIGGER MyInsert
AFTER INSERT ON A
FOR EACH ROW
INSERT INTO B VALUES
(NEW.col1, NEW.col2);
...
call psp_help_trigger(,'MyInsert')
Result Set
|
Database_Qualifier
|
TRIGGER_TEXT
|
|
Demodata
|
CREATE TRIGGER MyInsert
AFTER INSERT ON A
FOR EACH ROW
INSERT INTO B VALUES
(NEW.col1, NEW.col2);
|
call psp_help_trigger('wsrde', 'Myinsert')
Result Set
|
Database_Qualifier
|
TRIGGER_TEXT
|
|
wsrde
|
CREATE TRIGGER MyInsert
AFTER INSERT ON A
FOR EACH ROW
INSERT INTO B VALUES
(NEW.col1, NEW.col2);
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string
- If trigger_name is null, the following error message appears:
Trigger name cannot be null.
- If trigger_name is a blank string, the following error message appears:
Trigger name cannot be a blank string.
psp_help_udf
Returns the text of a given user-defined function (UDF) from the current database or the specified database.
Syntax
call psp_help_udf (['database_qualifier'], 'udf_name')
Arguments
Table 6-16 psp_help_udf - Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qual
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
udf_name
|
VARCHAR(255)
|
|
Name of the user-defined function whose function text is required.
|
Returned Result Set
Table 6-17 psp_help_udf - Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
DATABASE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
UDF_TEXT
|
LONGVARCHAR
|
The text of the User Defined Function
|
Examples
call psp_help_udf(, 'Myfunction')
Result Set
|
Database_Qualifier
|
UDF_TEXT
|
|
Demodata
|
Create function Myfunction(:a integer)
Returns integer
as
Begin
End
|
call psp_help_udf('wsrde', 'Getsmallest')
Result Set
|
Database_Qualifier
|
UDF_TEXT
|
|
wsrde
|
CREATE FUNCTION GetSmallest(:A
integer, :B Integer)
RETURNS Integer
AS
BEGIN
DECLARE :smallest INTEGER
IF (:A < :B ) THEN
SET :smallest = :A;
ELSE
SET :smallest = :B;
END IF;
RETURN :smallest;
END;
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string"
- If udf_name is a blank string, the following error message appears:
User-defined function name cannot be a blank string.
psp_help_view
Returns the definition text of a view, from the current database or the specified database.
Syntax
call psp_help_view(['database_qualifier'], 'view_name')
Arguments
Table 6-18 psp_help_view - Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
Database_qual
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
view_name
|
VARCHAR(255)
|
|
Name of the view whose definition text is required.
|
Returned Result Set
Table 6-19 psp_help_view - Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
DATABASE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
VIEW_TEXT
|
LONGVARCHAR
|
View definition text.
|
Permissions
You must have the permissions to:
- Execute a system stored procedure.
- Perform a SELECT on the X$View table.
Example
CREATE VIEW vw_Person (lastn,firstn,phone) AS
SELECT Last_Name, First_Name,Phone
FROM Person
...
call psp_help_view(,'vw_Person')
Result Set
|
Database_Qualifier
|
VIEW_TEXT
|
|
Demodata
|
SELECT "T1" ."Last_Name" ,"T1"
."First_Name" ,"T1" ."Phone"
FROM "Person" "T1"
|
call psp_help_view('wsrde', 'vw_Person')
Result Set
|
Database_Qualifier
|
VIEW_TEXT
|
|
wsrde
|
SELECT "T1" ."Last_Name" ,"T1"
."First_Name" ,"T1" ."Phone"
FROM "Person" "T1"
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string
- If view_name is null, the following error message appears:
View name cannot be null.
- If view_name is a blank string, the following error message appears:
View name cannot be a blank string.
psp_indexes
Returns the list of indexes defined for the specified table. For each index, it also lists the index properties as persisted in the X$Index table.
Syntax
call psp_indexes(['table_qualifier'], ['table_name'])
Arguments
Table 6-20 psp_indexes Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
table_qualifier
|
VARCHAR(20)
|
Current database
|
Name of the database from which the details are to be obtained
|
|
table_name
|
VARCHAR(255)
|
All tables
|
Name of the table for whose indexes are to be obtained.
|
Returned Result Set
Table 6-21 psp_indexes Returned Result Set
|
Column Name
|
Data Type
|
Description
|
|
TABLE_QUALIFIER
|
VARCHAR (20)
|
Name of the database
|
|
TABLE_OWNER
|
VARCHAR (20)
|
Name of the owner of the primary key table
|
|
TABLE_NAME
|
VARCHAR(255)
|
Name of the primary key table
|
|
INDEX_NAME
|
VARCHAR(255)
|
Name of the index
|
|
INDEX_TYPE
|
VARCHAR (20)
|
Type of the Index - Primary or Foreign
|
|
COLUMN_NAME
|
VARCHAR(255)
|
Name of the column on which index is defined
|
|
ORDINAL_POSITION
|
USMALLINT
|
Ordinal position of the index
|
|
DUPLICATES_ALLOWED
|
CHAR(3)
|
Yes - if it is a duplicate index
No - if it is not a duplicate index
|
|
UPDATABLE
|
CHAR(3)
|
Yes - if the index is updatable
No - if the index is not updatable
|
|
CASE_SENSITIVE
|
CHAR(3)
|
Yes - if the index is case-sensitive
No - if the index is not case-sensitive
|
|
ASC_DESC
|
CHAR(1)
|
D - Descending
A - Ascending
|
|
NAMED_INDEX
|
CHAR(3)
|
Yes - if it is a named index
No - if it is not a named index
|
Example
Result Set
|
Qual
|
TO
|
TN
|
IN
|
IT
|
CN
|
Opos
|
Dup
|
Up
|
Case
|
A/D
|
NI
|
|
Demodata
|
Null
|
Department
|
Dept_name
|
Null
|
Name
|
0
|
No
|
No
|
No
|
A
|
No
|
|
Demodata
|
Null
|
Department
|
Bldg_name
|
Null
|
Building_Name
|
0
|
Yes
|
Yes
|
No
|
A
|
No
|
|
Demodata
|
Null
|
Department
|
Dept_head
|
Null
|
Head_of_dept
|
0
|
No
|
No
|
No
|
D
|
No
|
|
.....
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend: Qual = Table_ qualifier; TO = Table_owner; TN = Table_name; IN = Index_name; IT = Index_type; CN = Column_name; Opos = Ordinal_position; Dup = Duplicates_allowed; UP = Updatable; Case = Case_ sensitive; A/D = Asc_desc; NI = Named_index
|
call psp_indexes('demodata', 'department')
Result Set
|
Qual
|
TO
|
TN
|
IN
|
IT
|
CN
|
Opos
|
Dup
|
Up
|
Case
|
A/D
|
NI
|
|
Demodata
|
Null
|
Department
|
Dept_name
|
Null
|
Name
|
0
|
No
|
No
|
No
|
A
|
No
|
|
Demodata
|
Null
|
Department
|
Bldg_name
|
Null
|
Building_Name
|
0
|
Yes
|
Yes
|
No
|
A
|
No
|
|
Demodata
|
Null
|
Department
|
Dept_head
|
Null
|
Head_of_dept
|
0
|
No
|
No
|
No
|
D
|
No
|
|
.....
|
|
|
|
|
|
|
|
|
|
|
|
|
Legend: Qual = Table_ qualifier; TO = Table_owner; TN = Table_name; IN = Index_name; IT = Index_type; CN = Column_name; Opos = Ordinal_position; Dup = Duplicates_allowed; UP = Updatable; Case = Case_ sensitive; A/D = Asc_desc; NI = Named_index
|
Error Conditions
- If database_qualifier is a blank string, the following error message appears:
Please enter a valid database name. Database name cannot be a blank string
- If table_name is a blank string, the following error message appears:
Table name cannot be a blank string.
psp_pkeys
Returns the primary key information for the specified table, from the current database or the database specified.
Syntax
call psp_pkeys(['pkey_table_qualifier']['table_name'])
Arguments
Table 6-22 psp_pkeys Arguments
|
Parameter
|
Type
|
Default Value
|
Description
|
|
pkey_table_qualifier
|
VARCHAR(20)
|