Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » SQL/PSM Functions » COLUMNNAME |
COLUMNNAME(<CursorName>,<Position>) <CursorName> = Previously-opened result set cursor <Position> = 1-based column position
VARCHAR
-- This procedure returns a semicolon-delimited -- string containing the column names for a given table CREATE FUNCTION ColumnNames(IN TableName VARCHAR COLLATE ANSI_CI) RETURNS VARCHAR COLLATE ANSI_CI BEGIN DECLARE ResultCursor SENSITIVE CURSOR FOR Stmt; DECLARE I INTEGER; DECLARE ResultColumnCount INTEGER; DECLARE Result VARCHAR DEFAULT ''; PREPARE Stmt FROM 'TABLE '+QUOTEDSTR(TableName,'"'); OPEN ResultCursor; SET I=1; SET ResultColumnCount=COLUMNCOUNT(ResultCursor); WHILE I <= ResultColumnCount DO IF Result <> '' THEN SET Result=Result+';'; END IF; SET Result=Result+COLUMNNAME(ResultCursor,I); SET I=I+1; END WHILE; CLOSE ResultCursor; RETURN Result; END
Deviation | Details |
Extension | This function is an ElevateDB extension. |
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |