Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » SQL/PSM Statements » PREPARE |
PREPARE <StatementName> FROM <SQLStatement>
-- This function looks up the sales tax -- rate for a given state and county CREATE FUNCTION LookupSalesTaxRate(IN State CHAR(2), IN County VARCHAR) RETURNS DECIMAL(19,2) BEGIN DECLARE TempCursor CURSOR FOR stmt; DECLARE Result DECIMAL(19,2) DEFAULT 0; PREPARE stmt FROM 'SELECT * FROM SalesTaxes WHERE State = ? AND County = ?'; OPEN TempCursor USING State, County; IF (ROWCOUNT(TempCursor) > 0) THEN FETCH FIRST FROM TempCursor ('TaxRate') INTO Result; END IF; CLOSE TempCursor; RETURN Result; END
Deviation | Details |
Dynamic SQL | The use of dynamic SQL for DDL, DML, and administrative statement execution instead of static SQL in procedures and functions is both an ElevateDB extension and a deviation from the standard. |
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 |