RE: [firebird-support] Is it a Trigger Problem?

2019-07-17 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Zoran! I suggest you to make unique key on "T_ORDERCUSTOMER".OrderId and T_ORDERVEHICLE".OrderId and you will get an exception when the secound row is inserted into the tables. Maybe this helps to find out where is the problem. András From: firebird-support@yahoogroups.com Sent:

RE: [firebird-support] Query that was very fast under the oldest 2.5 versions are very slow under 2.5.8 or 2.5.9

2019-05-28 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! I sent this e-mail two times at saturday, but yahoo didn’t deliver it. I try it again: Hi Dany! Try with CTE: with procs as ( select distinct "PROC" from "MOVI" where "MOVI"."TIPO" in ('1','A','B')

RE: [firebird-support] Query optimization when using sub query with in operator

2019-03-01 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! Try this: with ids as (select '123' id from RDB$DATABASE ) select a.* from AnyTable a inner join ids i on i.id = a.id András From: firebird-support@yahoogroups.com Sent: Friday, March 1, 2019 1:11 AM To: firebird-support@yahoogroups.com Subject: [firebird-support] Query

Re: [firebird-support] Re: optimal free disk space

2019-02-25 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! Read only, read commited transactions can be long running, but read only snapshots can't. -- András Eredeti üzenet Feladó: "shg_siste...@yahoo.com.ar [firebird-support]" Dátum: 2019. 02. 25. 17:54 (GMT+01:00) Címzett: firebird-support@yahoogroups.com Tárgy:

Válasz: [firebird-support] Consecutive values from different fields

2019-01-27 Thread Omacht András aoma...@mve.hu [firebird-support]
Edit previous line, add semicolon at the end: wd1 = wd2; András Eredeti üzenet Feladó: "'Autoneer' myauton...@gmail.com [firebird-support]" Dátum: 2019. 01. 27. 9:04 (GMT+01:00) Címzett: firebird-support@yahoogroups.com Tárgy: RE: [firebird-support] Consecutive values from

RE: [firebird-support] long condition faster?

2019-01-03 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Olaf! select bon.* from (select case when t.price > 100 then 'EXPENSIVE' else 'CHEAP' end buy_or_not from t) bon where bon.buy_or_not = 'CHEAP' András From: firebird-support@yahoogroups.com Sent: Thursday, January 3, 2019

RE: [firebird-support] Re: Transaction access mode (read only vs. read write) from context?

2018-09-14 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Vlad! Thank you! Is it possible to backport this items to 2.5.9? András From: firebird-support@yahoogroups.com Sent: Wednesday, September 12, 2018 6:13 PM To: firebird-support@yahoogroups.com Subject: [firebird-support] Re: Transaction access mode (read only vs. read write) from context?

RE: [firebird-support] Prevent overlaping dates in concurentenvironment

2018-09-13 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Karol! Yes, but if you do lock in MEETINGS_UQ_BI the lock will hold only while the trigger runs in autonomous transaction. Depending on the business logic it can be much more shorter (some millisecounds) than locking in „parent” transaction and hold it for minutes or more waiting for user

RE: [firebird-support] Prevent overlaping dates in concurent environment

2018-09-12 Thread Omacht András aoma...@mve.hu [firebird-support]
. András From: firebird-support@yahoogroups.com Sent: Wednesday, September 12, 2018 1:59 PM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Prevent overlaping dates in concurent environment On 12.09.2018 at 13:29, Omacht András aoma...@mve.hu [firebird-support] wrote:

RE: [firebird-support] Prevent overlaping dates in concurent environment

2018-09-12 Thread Omacht András aoma...@mve.hu [firebird-support]
support] Prevent overlaping dates in concurent environment On 12.09.2018 at 13:29, Omacht András aoma...@mve.hu [firebird-support] wrote: > Create a (reserved_dates) table with date field, and make that field unique.. > When a user inserts a date into the reservation table a

RE: [firebird-support] Prevent overlaping dates in concurent environment

2018-09-12 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Karol! Create a (reserved_dates) table with date field, and make that field unique.. When a user inserts a date into the reservation table a trigger immadiate inserts this date to the reserved_dates table too. Then the unique key will stop secound insert instead of the first transaction is

[firebird-support] Transaction access mode (read only vs. read write) from context?

2018-09-12 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi All! According to the documentation (https://firebirdsql.org/refdocs/langrefupd20-get-context.html) I can retrive the transaction's isolation level: select rdb$get_context('SYSTEM', 'ISOLATION_LEVEL') from rdb$database But I need to know the access mode too. Is this possible somehow to know

RE: [firebird-support] "starting with" inside a procedure

2018-07-24 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Sergio! Starting with is your friend. create or alter procedure ST_WITH (IN1 varchar(100), IN2 varchar(100)) returns (OK char(1)) as begin if (IN1 starting with IN2) then begin ok = 'Y'; end else begin ok = 'N'; end suspend; end select * from st_with('WORD',

Re: [firebird-support] get number of combinations of to keys

2018-07-16 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Set, isn't select count(1) from (select pro, fa from tab where Key = :Key group by pro, fa) into :ProFaCount enough? András Feladó: firebird-support@yahoogroups.com , meghatalmazó: Svein Erling Tysvaer

RE: [firebird-support] Delete issue

2018-06-15 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Set, because I was in hurry and did not optimize enough. Point goes to you.  András From: firebird-support@yahoogroups.com [mailto:firebird-supp...@yahoogroups..com] Sent: Friday, June 15, 2018 11:09 AM To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] Delete issue

RE: [firebird-support] Delete issue

2018-06-15 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Anonymous! I think you sould check and run if correct this statement: delete from tplan_kw_pos x where not exists (select 1 from tplan_kw_pos a inner join tauftr_ge b on a.auftragsjahr = b.jahr and a.auftragsnr = b.nr

RE: [firebird-support] WITH RECURSIVE or not WITH RECURSIVE

2018-05-30 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Gábor! I see, you have many root elements. Then Mark gave the perfect solution: WITH RECURSIVE tree AS ( SELECT t.id, t.parent_id FROM table1 t inner join table1 root on root.id = t.parent_id WHERE root.parent_id is null UNION ALL

RE: [firebird-support] WITH RECURSIVE or not WITH RECURSIVE

2018-05-30 Thread Omacht András aoma...@mve.hu [firebird-support]
To: firebird-support@yahoogroups.com Subject: Re: [firebird-support] WITH RECURSIVE or not WITH RECURSIVE 2018. 05. 29. 19:08 keltezéssel, Omacht András aoma...@mve.hu [firebird-support] írta: > Hi Gabor! > > You can do it with recursive cte: First of all, thank you very much! But... I got

RE: [firebird-support] WITH RECURSIVE or not WITH RECURSIVE

2018-05-29 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Gabor! You can do it with recursive cte: WITH RECURSIVE tree AS ( SELECT t.id, t.parent_id FROM table1 t WHERE t.parent_id = (select root.id from table1 root where root.parent_id is null) UNION ALL SELECT m.id, t.parent_id

RE: [firebird-support] Firebird using all available memory

2018-05-23 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Fabiano! You should run garbage collection (sweep). Oldest transaction 905 Oldest active 62303005 Oldest snapshot 62303005 Next transaction62382577 András OMACHT ANDRÁS fejlesztési igazgató [cid:image001.png@01CFE703.C881C660]

RE: [firebird-support] Re: Firebird temp files

2018-05-09 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Karol, we have chosen the following solution to avoid temp disk writes: * Firebird 2.5.8 classic default configuration (with 2 changes see below) * 456 databases (~379 GB) * average ~4000 fb_inet_server processes * 10 GB ramdisk (/ramdisk/fb_temp) for external files and for

RE: [firebird-support] Problem returning multiple rows from a CTE-recursive procedure

2018-05-03 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! You should suspend every records like this: DO begin IF (PI_KEY_IN = 0) THEN EXCEPTION ROOT_CAT_NODE_DELETE; SUSPEND; end András From: firebird-support@yahoogroups.com [mailto:firebird-supp...@yahoogroups..com] Sent: Thursday, May 3, 2018 10:33 PM To:

RE: [firebird-support] Optional FK constraint on 0 (not NULL)

2018-03-28 Thread Omacht András aoma...@mve.hu [firebird-support]
Sorry, two little corrections: 3. create a before insert or update trigger which fill up this field like this: new.master_id_fk = nullif(new.master_id, 0); András From: firebird-support@yahoogroups.com [mailto:firebird-supp...@yahoogroups..com] Sent: Wednesday, March 28, 2018 9:44 AM To:

RE: [firebird-support] Optional FK constraint on 0 (not NULL)

2018-03-28 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Bhavbhuti, I can suggest you only a workaround…. 1. your current field name is: MASTER_ID 2. add a new field, e.g.: MASTER_ID_FK 3. create a before insert and update trigger which fill up this field like this: new.master_id_fk = nullif(master_id, 0); 4. create the foreign key on

RE: [firebird-support] select *at least* N rows

2018-03-23 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Sergio and Mark, a bit more general solution (for example max. 100 empty rows without 100 union all): with recursive last_empty_row as ( select 100 rownum -- set expected row number here from rdb$database), empty_rows as ( select 1 rownum from rdb$database union all

RE: [firebird-support] update or insert from in-line query

2018-03-19 Thread Omacht András aoma...@mve.hu [firebird-support]
query On 19-3-2018 07:51, Omacht András aoma...@mve.hu [firebird-support] wrote: > Hi Hamis, > > > > merge is your friend: > > https://firebirdsql.org/refdocs/langrefupd21-merge.html > > > > In FB 2.5 series only insert and update is supported. What do you

RE: [firebird-support] update or insert from in-line query

2018-03-19 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Hamis, merge is your friend: https://firebirdsql.org/refdocs/langrefupd21-merge.html In FB 2.5 series only insert and update is supported. András From: firebird-support@yahoogroups.com [mailto:firebird-supp...@yahoogroups..com] Sent: Monday, March 19, 2018 7:48 AM To:

RE: [firebird-support] ASCII values

2018-03-08 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Hugo! If i understood well, you need this (tested on Fb2.5.8): select * from table where field = ascii_char(3) || ascii_char(1); or select * from table where ascii_val(substring(field from 1 for 1) = 3 and ascii_val(substring(field from 2 for 1) = 1; András From:

RE: [firebird-support] exponential, string to double precision

2018-02-27 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi Olaf! Try this: select cast('+0.200E+01' as double precision) from rdb$database András From: firebird-support@yahoogroups.com [mailto:firebird-supp...@yahoogroups..com] Sent: Wednesday, February 28, 2018 7:44 AM To: firebird-support@yahoogroups.com Subject: [firebird-support]

RE: [firebird-support] Select freezes

2017-12-31 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! Maybe the select starts the garbage collection, and it slows down it. When you run backup without -g it does the garbage collection too, so could fix the problem. (Are you running it with / without -g?) * How many updates / delete run average on that table? Is it often changed or

RE: [firebird-support] Get the value of Query Not Available In Table

2017-11-28 Thread Omacht András aoma...@mve.hu [firebird-support]
Hi! with nums as ( select 1 num from rdb$database union all select 2 num from rdb$database) select n.num from nums n where not exists (select 1 from temptable t where t.id = n.num) András From: firebird-support@yahoogroups.com