Concat string operator in i4gl
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
When I am applying concat operator (||) inside i4gl statement, I get an
error message indicating it is invalid character.
So,
declare cur_rop cursor for
select rwtnkb_kode, rop_nopol
from r_op
where (rwtnkb_kode || rop_nopol) = 'uhk'|__________________________^
I get error #-4409 but finderr told it, "contains some character other
than printable text and normal white space."
How to perform concat operation in i4gl?
Thanks for your attention.
--
-- ikhlasul
Sent via Deja.com http://www.deja.com/
Before you buy.
Ikhlasul Amal wrote:
> When I am applying concat operator (||) inside i4gl statement, I get an
> error message indicating it is invalid character.
>
> So,
>
> declare cur_rop cursor for
> select rwtnkb_kode, rop_nopol
> from r_op
> where (rwtnkb_kode || rop_nopol) = 'uhk'> |__________________________^
>
> I get error #-4409 but finderr told it, "contains some character other
> than printable text and normal white space."
>
> How to perform concat operation in i4gl?
Upgrade to 7.30.
You may need to use:
DECLARE cur_rop CURSOR FOR SQL
SELECT rwtnkb_kode, rop_nopol
FROM r_op
WHERE (rwtnkb_kode || rop_nopol) = 'uhk'
END SQL
Otherwise, as our friend the Obnoxious Clown suggested, use PREPARE and
DECLARE.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
4Gl's string concatenation operator (,) is different from SQL's. To
use SQL containing the SQL concatenation operator (||) you need to
build the query in a string and PREPARE it.
Art S. Kagel
Ikhlasul Amal wrote:
>
> When I am applying concat operator (||) inside i4gl statement, I get an
> error message indicating it is invalid character.
>
> So,
>
> declare cur_rop cursor for
> select rwtnkb_kode, rop_nopol
> from r_op
> where (rwtnkb_kode || rop_nopol) = 'uhk'> |__________________________^
>
> I get error #-4409 but finderr told it, "contains some character other
> than printable text and normal white space."
>
> How to perform concat operation in i4gl?
> Thanks for your attention.
>
> --
> -- ikhlasul
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
You have to prepare the instruction. Check the example:
define
g_scratch char(500),
m_b_cust_name char(6)
###########################################################################
function bus_cust_name(f_cust_num)
###########################################################################
# busco el nombre del cliente
#
define
f_cust_num like customer.cust_num,
f_cust_name like customer.cust_name
if m_b_cust_name = "select"
then
else
let m_b_cust_name = "select"
let g_scratch =
"select cust_name ",
"from customer ",
"where cust_num = ? "
prepare p_b_cust_name from g_scratch
declare c_b_cust_name cursor for p_b_cust_name
free p_b_cust_name
end if
let f_cust_name = null
if f_cust_num is not null
then
open c_b_cust_name using f_cust_num
fetch c_b_cust_name into f_cust_name
close c_b_cust_name
end if
return f_cust_name
end function
# bus_cust_name()
Ikhlasul Amal wrote:
> When I am applying concat operator (||) inside i4gl statement, I get an
> error message indicating it is invalid character.
>
> So,
>
> declare cur_rop cursor for
> select rwtnkb_kode, rop_nopol
> from r_op
> where (rwtnkb_kode || rop_nopol) = 'uhk'> |__________________________^
>
> I get error #-4409 but finderr told it, "contains some character other
> than printable text and normal white space."
>
> How to perform concat operation in i4gl?
> Thanks for your attention.
>
> --
> -- ikhlasul
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
I4gl does not support concate operators in where
condition. But this can accomplished by declaring
another variable which stores both the columns
and then check the value....
considering the problem as example :
declare cur_rop cursor for
select rwtnkb_kode, rop_nopol
from r_op
foreach cur_rop into lv_rwtnkb_kode, lv_rop_nopol
let lv_rw_rop =
lv_rwtnkb_kode CLIPPED,lv_rop_nopol CLIPPED
if lv_rwtnkb_kode = "uhk"
then
# .... body statement...
end if
end foreach
free cur_rop
The bottom line is ',' (comma) is the concate
operator.
article <8ml677$5ag$1@nnrp1.deja.com>,
Ikhlasul Amal <ikhlasul@my-deja.com> wrote:
> When I am applying concat operator (||) inside
i4gl statement, I get an
> error message indicating it is invalid
character.
>
> So,
>
> declare cur_rop cursor for
> select rwtnkb_kode, rop_nopol
> from r_op
> where (rwtnkb_kode || rop_nopol) = 'uhk'> |__________________________^
>
> I get error #-4409 but finderr told
it, "contains some character other
> than printable text and normal white space."
>
> How to perform concat operation in i4gl?
> Thanks for your attention.
>
> --
> -- ikhlasul
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.