Advertisement
econz

Firebird - Execute Statement com Parâmetros

Feb 3rd, 2017
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.68 KB | None | 0 0
  1. /* https://firebirdsql.org/rlsnotesh/rnfb25-psql-exctstmnt.html */
  2.  
  3. EXECUTE block
  4.    RETURNS (
  5.       VAL_A INTEGER,
  6.       VAL_B INTEGER,
  7.       VAL_C INTEGER
  8.    )
  9. AS
  10. BEGIN
  11.  
  12.  
  13.    -- Formato 1
  14.    -- Variaveis nomeadas ( X, Y e Z )
  15.    EXECUTE statement
  16.       ('Select CAST(:X AS INT), CAST(:Y AS INT), CAST(:Z AS INT) from RDB$DATABASE')
  17.       (X := 1, Y:=2, Z:=3)
  18.    INTO
  19.       :VAL_A,
  20.       :VAL_B,
  21.       :VAL_C;
  22.  
  23.    suspend;
  24.  
  25.  
  26.  
  27.    -- Formato 2
  28.    -- Variaveis sem nome   "?"
  29.    EXECUTE statement
  30.       ('Select CAST(? AS INT), CAST(? AS INT), CAST(? AS INT) from RDB$DATABASE')
  31.       (1,2,3)
  32.    INTO
  33.       :VAL_A,
  34.       :VAL_B,
  35.       :VAL_C;
  36.  
  37.    suspend;
  38.  
  39.  
  40.  
  41. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement