Questions tagged [firebird-psql]

The procedural language for the Firebird database. Use this tag for questions concerning Firebird stored procedures, triggers, execute block or PSQL stored functions.

Firebird calls its procedural language "psql" (Procedural SQL). This should not be confused with PostgreSQL's command line tool psql.

PSQL is used to define stored procedures, triggers, anonymous procedures (execute block), and - since Firebird 3.0 - PSQL stored functions.

Resources

See also

27 questions
1
vote
1 answer

Resolving a singleton error in a stored procedure

I have the following stored procedure in Firebird SQL: ALTER PROCEDURE SP_REPORT_USD ( PER SMALLINT ) RETURNS ( ACCOUNT_NUMBER CHAR(21), AMOUNT NUMERIC(15, 4) ) AS BEGIN SELECT L.ACCOUNT_NUMBER,…
gdekoker
  • 185
  • 8
1
vote
1 answer

Assistance with Firebird SQL stored procedure

I have a very simple stored procedure: ALTER PROCEDURE SP_BALANCE_USD ( PER SMALLINT ) RETURNS ( ACCOUNT_NUMBER CHAR(21), AMOUNT NUMERIC(15, 4) ) AS BEGIN SELECT L.ACCOUNT_NUMBER, SUM(-(CURRROUND(L.DEBIT,2) -…
gdekoker
  • 185
  • 8
1
vote
1 answer

Error in Firebird Procedure

I have to do one query to get one parameter (I need a "1"), but this parameter can be in different cells, for…
Nicolas Oñate
  • 221
  • 2
  • 12
0
votes
1 answer

Accessing each row in a table and calling a procedure multiple times

GET_STRING_LIST takes a string list as input and returns an ordered table of different IDs in a variable :RES_TABLE. I would like to take every row (ID) in :RES_TABLE and call a procedure GET_VALUES for 2 different coefficients. The way the code is…
nemi
  • 67
  • 1
  • 7
0
votes
1 answer

Get value from Firebird cursor by field name

I need get data from cursor by field name, stored in var. For example, I have statement: for select CUBE1, CUBE2, CUBE3, ....., CUBE31 from GET_DATA(......) B where ..... as cursor cvol do And now I need get value from cursor by dynamically…
Evgeny
  • 3,910
  • 2
  • 20
  • 37
0
votes
1 answer

Firebird multiple rows in singleton select Where Like

I'm trying to get multiple rows with a like condition. EXECUTE BLOCK RETURNS (ID Varchar(128), SCRIPT BLOB SUB_TYPE TEXT) AS BEGIN FOR SELECT Col1.EID, Col1.Script FROM Col1 WHERE Col1.Script Like %test12% INTO :ID, :SCRIPT DO BEGIN …
scotti8
  • 21
  • 1
  • 3
0
votes
1 answer

Firebird stored procedure with indexed variable using execute statement

How can I use indexed variable in a Firebird stored procedure? I mean, I have output parameters ODATE1, ODATE2, ODATE3, can I use as ':ODATE' || COUNTER to set the value in a loop? I have 2 tables like this: 1. T_EMPLOYEE --------------- …
0
votes
1 answer

Add new row for first of same group

I'm new to Firebird and need your help. I know that Firebird's task isn't to do a nice print. I have a stored procedure with following reduced output: Drink Name Cola Marcus Cola Siegfried Fanta Jochen Beer Anna Beer Manuel I…
0
votes
0 answers

Trigger SQL Server for Firebird

I have a SQL Server trigger that I have tried to convert for Firebird but seems like I have some trouble with it. Here is my SQL trigger: CREATE TRIGGER [dbo].[IDSOFT_INTERV_UI] ON [MMAINT_SOCO_PROD].[dbo].[T_ZONES_LIBRES_UI] AFTER UPDATE AS…
0
votes
1 answer

procedure return True or False

I need a stored procedure in firebird 3.0 to return True, False or 1,0 result to check if this person or the record exists in database. If exists the procedure should return true, if not return False, or return 1, if not return 0 This is my…
Sahat
  • 29
  • 1
  • 7
0
votes
0 answers

Changing data type from varchar to integer

I'm trying to find the first free number (SYMBOL_ZAM) in a table and add 1, to make a unique one for my new record. First I'm selecting the last added number into a varchar variable (OST_SZUK_NR) and then I was trying to make field NOWY_SYMB_ZAM the…
0
votes
0 answers

Insert null value

I'm trying to Insert a double precision (ilosc_zlec) value into a table (M_ZAMWLASNEPOZ). First I use a select statement to get the value. After I run this part of code, I can see the correct value in the variable ( 39 ). Next I'm trying to insert…
1
2