/******************************************************************************/ /**** Generated by IBExpert 2016.12.8.1 04.06.2018 13:23:03 ****/ /******************************************************************************/ /******************************************************************************/ /**** Following SET SQL DIALECT is just for the Database Comparer ****/ /******************************************************************************/ SET SQL DIALECT 3; /******************************************************************************/ /**** Domains ****/ /******************************************************************************/ CREATE DOMAIN DTEST AS VARCHAR(100); CREATE DOMAIN DTEST200 AS VARCHAR(200); /******************************************************************************/ /**** Stored procedures ****/ /******************************************************************************/ SET TERM ^ ; CREATE OR ALTER PROCEDURE GET_VALOARE ( ID INTEGER) RETURNS ( VALOARE VARCHAR(10)) AS BEGIN SUSPEND; END^ CREATE OR ALTER PROCEDURE TEST_DATE_ADD ( A DATE) RETURNS ( B DATE) AS BEGIN SUSPEND; END^ CREATE OR ALTER PROCEDURE TEST_POSITION ( A VARCHAR(100)) RETURNS ( B INTEGER) AS BEGIN SUSPEND; END^ SET TERM ; ^ /******************************************************************************/ /**** Tables ****/ /******************************************************************************/ CREATE TABLE TEST2 ( ID INTEGER NOT NULL, NUME VARCHAR(20), VALOARE NUMERIC(18,4) ); CREATE TABLE TEST ( ID INTEGER NOT NULL, IBE$TEST INTEGER, TEST DTEST200, TEST2 DTEST ); CREATE TABLE TEST3 ( ID INTEGER NOT NULL ); ALTER TABLE TEST ADD CLC_NUME COMPUTED BY ((SELECT NUME FROM TEST2 WHERE TEST.ID=TEST2.ID)); ALTER TABLE TEST ADD CLC_VALOARE COMPUTED BY ((SELECT VALOARE FROM TEST2 WHERE TEST2.ID=TEST.ID)); ALTER TABLE TEST3 ADD CLC_VALOARE COMPUTED BY ((SELECT VALOARE FROM GET_VALOARE(TEST3.ID))); /******************************************************************************/ /**** Primary keys ****/ /******************************************************************************/ ALTER TABLE TEST ADD CONSTRAINT PK_TEST PRIMARY KEY (ID); ALTER TABLE TEST2 ADD CONSTRAINT PK_TEST2 PRIMARY KEY (ID); ALTER TABLE TEST3 ADD CONSTRAINT PK_TEST3 PRIMARY KEY (ID); /******************************************************************************/ /**** Stored procedures ****/ /******************************************************************************/ SET TERM ^ ; CREATE OR ALTER PROCEDURE GET_VALOARE ( ID INTEGER) RETURNS ( VALOARE VARCHAR(10)) AS BEGIN FOR SELECT T.CLC_VALOARE FROM TEST T WHERE T.ID = :ID INTO :VALOARE DO SUSPEND; END^ CREATE OR ALTER PROCEDURE TEST_DATE_ADD ( A DATE) RETURNS ( B DATE) AS BEGIN /* */ B = DATEADD(3 MONTH TO :A); SUSPEND; END^ CREATE OR ALTER PROCEDURE TEST_POSITION ( A VARCHAR(100)) RETURNS ( B INTEGER) AS BEGIN /* */ B = POSITION(';', :A); SUSPEND; END^ SET TERM ; ^ /******************************************************************************/ /**** Privileges ****/ /******************************************************************************/ /* Privileges of users */ GRANT EXECUTE ON PROCEDURE GET_VALOARE TO ION; GRANT EXECUTE ON PROCEDURE GET_VALOARE TO REPL;