Skip to content
Advertisement

Mysql Procedure Syntax change to Firebird Procedure Syntax

I don’t know what’s different about the stored procedure of firebird syntax.

MySql Procedure:

ALTER PROCEDURE [dbo].[SP_CAL_SHIFTDTL]
(
  @PSHIFTDTEFROM DATETIME,
  @PSHIFTDTETO DATETIME
)
AS
BEGIN
   SET NOCOUNT ON
   DECLARE @GEN_EXCEPTION_FROM DATETIME,
           @GEN_EXCEPTION_TO DATETIME

   SELECT @GEN_EXCEPTION_FROM = @PSHIFTDTEFROM,
          @GEN_EXCEPTION_TO = @PSHIFTDTETO

How can I change this one syntax for Firebird stored procedure?

SELECT @GEN_EXCEPTION_FROM = @PSHIFTDTEFROM,
       @GEN_EXCEPTION_TO = @PSHIFTDTETO

Advertisement

Answer

The equivalent in Firebird PSQL syntax would be simple assignment, so GEN_EXCEPTION_FROM = PSHIFTDTEFROM; See also Assignment Statements in the Firebird Language Reference. The full equivalent of the fragment shown in your question would be:

RECREATE PROCEDURE SP_CAL_SHIFTDTL
(
    PSHIFTDTEFROM TIMESTAMP,
    PSHIFTDTETO TIMESTAMP
)
AS
DECLARE GEN_EXCEPTION_FROM TIMESTAMP;
DECLARE GEN_EXCEPTION_TO TIMESTAMP;
BEGIN
    GEN_EXCEPTION_FROM = PSHIFTDTEFROM;
    GEN_EXCEPTION_TO = PSHIFTDTETO;
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement