SQL problem accessing another database
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hey , I know this is crazy but we're still using ESQLCOBOL. We're having
a peculiar
compile problem, Have an Declare SQL statement where we want to acccess
a table in another Informix database. This other database can change from
development to production of course, so the database is in a variable.
Below is SQL
exec SQL
declare data_entry_csr cursor with hold for
select data_entry_id,
batch_type_code,
transaction_data,
date_data_entered,
needs_verific_date,
date_verified,
csr_id,
ss_index_value
13 from :de-database-server,13 data_entry
where data_entry_id > 0 and
batch_type_code in
102296 ('76' , '84' , '85', '86', '87', '88')
082796 and ( ( update_lock is null and
082796 date_verified is null )
082796 or
082796 ( update_lock = '2' and
082796 date_verified is not null) )
order by batch_type_code, data_entry_id
end-exec.
Compiler doesn't like :de-database-server.
Is the only way to do this through a prepare statement.
ciao
p
******************************************************************************
Peter Wages
pmwages@cais.com
Work: (703) 741-7436 Home: (703) 528-9569
******************************************************************************
Yes. Table names must be literals in a FROM clause. You will have to
build the statement in a string and PREPARE it.
Art S. Kagel
Peter Wages wrote:
>
> Hey , I know this is crazy but we're still using ESQLCOBOL. We're having
> a peculiar
> compile problem, Have an Declare SQL statement where we want to acccess
> a table in another Informix database. This other database can change from
> development to production of course, so the database is in a variable.
>
> Below is SQL
>
> exec SQL
> declare data_entry_csr cursor with hold for
> select data_entry_id,
> batch_type_code,
> transaction_data,
> date_data_entered,
> needs_verific_date,
> date_verified,
> csr_id,
> ss_index_value
> 13 from :de-database-server,> 13 data_entry
> where data_entry_id > 0 and
> batch_type_code in
> 102296 ('76' , '84' , '85', '86', '87', '88')
> 082796 and ( ( update_lock is null and
> 082796 date_verified is null )
> 082796 or
> 082796 ( update_lock = '2' and
> 082796 date_verified is not null) )
> order by batch_type_code, data_entry_id
> end-exec.
>
> Compiler doesn't like :de-database-server.
>
> Is the only way to do this through a prepare statement.
>
> ciao
> p
>
> ******************************************************************************
> Peter Wages
> pmwages@cais.com
> Work: (703) 741-7436 Home: (703) 528-9569
> ******************************************************************************