Subject | RE: [firebird-support] "starting with" inside a procedure |
---|---|
Author | Omacht András |
Post date | 2018-07-24T17:18:13Z |
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', 'WO')
OK
Y
select * from st_with('WORD', 'X')
OK
N
András
From: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Sent: Tuesday, July 24, 2018 6:13 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] "starting with" inside a procedure
Hello! I know that there are a lot of different ways to accomplish this, but I wonder if I'm missing something...
if I want (inside a stored proc or a trigger) to know if str1 starts with str2, I can do:
if (position(str2 in str1) = 1) then...
but there isn't something like the "starts with" predicate we have in SQL...?
if (str1 starts with str2) then...
thanks!!!
Sergio
__________ Information from ESET Mail Security, version of virus signature database 17768 (20180724) __________
The message was checked by ESET Mail Security.
http://www.eset.com
[Non-text portions of this message have been removed]
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', 'WO')
OK
Y
select * from st_with('WORD', 'X')
OK
N
András
From: firebird-support@yahoogroups.com <firebird-support@yahoogroups.com>
Sent: Tuesday, July 24, 2018 6:13 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] "starting with" inside a procedure
Hello! I know that there are a lot of different ways to accomplish this, but I wonder if I'm missing something...
if I want (inside a stored proc or a trigger) to know if str1 starts with str2, I can do:
if (position(str2 in str1) = 1) then...
but there isn't something like the "starts with" predicate we have in SQL...?
if (str1 starts with str2) then...
thanks!!!
Sergio
__________ Information from ESET Mail Security, version of virus signature database 17768 (20180724) __________
The message was checked by ESET Mail Security.
http://www.eset.com
[Non-text portions of this message have been removed]