Subject | Using LIKE/MATCHING? in stored procedure |
---|---|
Author | Tor Jørgen Brekka |
Post date | 2015-08-05T10:58:34Z |
Hello,
I need help with the following stored procedure that I need to change:
Here is a part of it like it is today:
-----------------------------------------------
BEGIN
SELECT PRODUCTIONLINENR FROM TBLPRODUCTIONLINE WHERE ESXKEY = :ESXPRODUCTIONLINE into :PRODUCTIONLINENR;
END
----------------------------------------------
If :ESXPRODUCTIONLINE = 'L1' and one record in field ESXKEY = 'L1' then this is no problem.
But now I want to change the data in ESXKEY so it contains several "L values" in same record separated by semicolon, like this:
Record 1, ESXKEY = 'L1;L2'
Record 2, ESXKEY = 'L11;L12'
Record 3....
:ESXPRODUCTIONLINE will still have only one "L value" eg 'L1'
How can I change my SELECT string to get result from record 1 only, if I use LIKE %ESXPRODUCTIONLINE% I will get match in both record 1 and 2 I believe.
Hope someone can help me.
Vennlig hilsen / Best regards
Tor Jørgen Brekka
e-post: tor.jorgen@...<mailto:tor.jorgen@...>
Mobil: +47 92493231
Kameleon Coding Automation AS
Johan Follestads vei 21, 3474 Åros
Tlf: +47 41 53 53 00 Fax: +47 41 53 53 01
http://www.kameleongruppen.no<http://www.kameleongruppen.no/>
[KCAAS_Liten] [cid:image004.jpg@01D0CF7E.701BBF80]
[Non-text portions of this message have been removed]
I need help with the following stored procedure that I need to change:
Here is a part of it like it is today:
-----------------------------------------------
BEGIN
SELECT PRODUCTIONLINENR FROM TBLPRODUCTIONLINE WHERE ESXKEY = :ESXPRODUCTIONLINE into :PRODUCTIONLINENR;
END
----------------------------------------------
If :ESXPRODUCTIONLINE = 'L1' and one record in field ESXKEY = 'L1' then this is no problem.
But now I want to change the data in ESXKEY so it contains several "L values" in same record separated by semicolon, like this:
Record 1, ESXKEY = 'L1;L2'
Record 2, ESXKEY = 'L11;L12'
Record 3....
:ESXPRODUCTIONLINE will still have only one "L value" eg 'L1'
How can I change my SELECT string to get result from record 1 only, if I use LIKE %ESXPRODUCTIONLINE% I will get match in both record 1 and 2 I believe.
Hope someone can help me.
Vennlig hilsen / Best regards
Tor Jørgen Brekka
e-post: tor.jorgen@...<mailto:tor.jorgen@...>
Mobil: +47 92493231
Kameleon Coding Automation AS
Johan Follestads vei 21, 3474 Åros
Tlf: +47 41 53 53 00 Fax: +47 41 53 53 01
http://www.kameleongruppen.no<http://www.kameleongruppen.no/>
[KCAAS_Liten] [cid:image004.jpg@01D0CF7E.701BBF80]
[Non-text portions of this message have been removed]