I am trying to perform an execute block using an update. However I am getting an error. The SQL shown here is similar to the real problem, but the update is much more complex. I need to use every declared cust_id into the update block. How can I accomplish that? Answer you cannot use do begin after our update statement
Tag: firebird
Token unkown error in stored procedure when updating on external database
I am using Firebird and I want to create a stored procedure to do an update in another database and I do not understand what I am missing because when compiling it gives me the following error: can’t format message 13:896 — message file C:WINDOWSfirebird.msg not found. Dynamic SQL Error. SQL error code = -104. Token unknown. suspend Answer The
Learning to use execute block in Firebird with a simple example
I haven’t used yet execute block in Firebird, but Im struggling to learn how to use it. I am trying to learn from a simple example and then will expand to a more complex situation. Suppose I have 2 tables like below: I have the following code. Basically, I want for every client in the client table to calculate the
How to cast varchar on update?
When I update t1 then “VALUE” field should increment but this field is set to VARCHAR and I would cast it to INTEGER: Answer You will need to cast “VALUE” to an integer to be able to increment it, so: Firebird will automatically convert the INTEGER back to a VARCHAR on assignment. See this dbfiddle. That said, the proper way
SQL replace and calculate character length and replace again
I want to do an update on a Firebird table. So far not a problem: Before the update statement my params look like this: After my update the params look like this: So far it’s ok. But the frontend program can not handle this because there is a checksum in the params. The value s:91 is the character length from
Select closest maximal numeric value in Firebird
Imagine there’re 2 tables, let’s call them “Master” and “Detail”: There’re 2 input parameters: list of Master IDs (master_id_list) and numeric value (num_value). For every ID in master_id_list I should get one Detail record: If num_value < MIN( f_value ), it should be the record with MIN( f_value ) If num_value > MAX( f_value ), it should be the record
Date of last day of week in Firebird 3
This is a date of first day of week (monday) in Firebird 3: DATEADD(DAY, (EXTRACT(WEEKDAY FROM D – 1) * -1), D) And how to get the date of the last day of the week (Sunday)? In Firebird: Mon = 1, …
Count double occurrences in order list
I have a list of orders, I need to find which ones occur with code 47 more than once with different users. For example: The expected result is 111 and 333. How can I accomplish this? Regards Answer I think you want aggregation and having: You can also express the having as:
SQL check whether current date is monday
I am trying to create a SQL statement in where clause so when the current date is a Monday, it returns Friday results, but if it is any other weekday, it returns yesterday as the result. Something …
Cannot create new procedure in SQL manager lite
I am working with SQL manager lite for Interbase/Firebird application. I have downloaded firebird database, successfully connected to that database and its host, but now I want to create procedure. I couldn’t done it via tutorials, so I decided to just click New->Procedure and do that automatically. But doing this way I still have errors. My code what I have