Subject | Re: [firebird-support] Get the value of Query Not Available In Table |
---|---|
Author | Svein Erling Tysvær |
Post date | 2017-11-28T11:48:43Z |
This is not possible in a direct query (well, unless you make a table that contains the numbers that you want to check), but with EXECUTE BLOCK you can do something similar:
execute block (FromValue integer = :MyFromValue, ToValue integer = :MyToValue)
returns (NotInTable integer)
as
begin
NotInTable = FromValue;
while (NotInTable <= ToValue) do
begin
if (not exists (select * from temptable
where id = :NotInTable )) then
suspend;
NotInTable = NotInTable + 1;
end
end
HTH,
Set
2017-11-28 11:56 GMT+01:00 antoedincharley@... [firebird-support] <firebird-support@yahoogroups.com>:
Hi,
I am looking for a solution to get values in query and those not available in table data.
CREATE TABLE TEMPTABLE(
ID SMALLINT);
INSERT INTO TEMPTABLE(ID) VALUES(1);
SELECT * FROM TEMPTABLE
WHERE ID IN (1,2)
in the Above case I want to get the value 2 as output of a query.
Kindly Help.
Thanks In Advance.