if else error in dbaccess
Posted in 2007
Topics: SQL Development & Query Writing, Stored Procedures & SPL, Server Administration
Hi,
I have to convert some sqls from MSSQl to INFORMIX which is as below
if (some select statement)> value
exec ('some sql')
else
exec ('some sql')
go
my problem is dbaccess is not supporting if else. when i searched net i found
they are used in spl only, any workarround to solve this
i have to create .sql file and fire it againest dbaccess
Hi,
The only possibility I can think of is using a function or procedure.
This can be coded in a sql file of course.
Inside an query, you have no possibility to place a choice.
What is the return of your sql, a single value ?
In this case, you could maybe use the case when construct.
Select case when (subselect) > value then (subselect2) else (subselect3)
From anytable (resulting in one row).
Marcus
-----Original Message-----
From: KRISHNAKANTH VINNAKOTA [mailto:krishnakanth_vvs@hotmail.com]
Sent: Monday, April 23, 2007 1:36 PM
To: ids@iiug.org
Subject: if else error in dbaccess [8997]
Hi,
I have to convert some sqls from MSSQl to INFORMIX which is as below
if (some select statement)> value
exec ('some sql')
else
exec ('some sql')
go
my problem is dbaccess is not supporting if else. when i searched net i
found they are used in spl only, any workarround to solve this
i have to create .sql file and fire it againest dbaccess
************************************************************************
*******
Forum Note: Use "Reply" to post a response in the discussion forum.
You can write a stored procedure (ie: in SPL) or you can script the alternative
logic at the OS level using shell scripting with dbaccess or Jonathan Leffler's
sqlcmd utility in server mode. Another alternative is to get Perl DBD/DBI
Informix and make this a Perl script that connects directly to the Informix
server or use some other host language interface (you have many to choose from:
Java, JDBC, C or C++ with ESQL/C, C or C++ with ODBC (CLI), the Informix SDK
C++
interface library, or Informix 4GL or one of it's clones (Aubit 4GL, Querix,
4Js ).
The main reason Informix has never implemented non-SQL programming language
like
syntax in its engines (like Oracle or MS SQL Server) is that it has always had
a broad range of more flexible programming interface alternatives.
Art S. Kagel
----- Original Message -----
From: Krishnakanth Vinnakota <ids@iiug.org>
At: 4/23 7:40:17
Hi,
I have to convert some sqls from MSSQl to INFORMIX which is as below
if (some select statement)> value
exec ('some sql')
else
exec ('some sql')
go
my problem is dbaccess is not supporting if else. when i searched net i found
they are used in spl only, any workarround to solve this
i have to create .sql file and fire it againest dbaccess
*******************************************************************************
Forum Note: Use "Reply" to post a response in the discussion forum.