Getting started ...
Posted in 1999
Topics: Installation, Setup & Upgrades, Stored Procedures & SPL, Triggers, Constraints & Referential Integrity
Unfortunately, after I installed informix on my laptop to learn how to use
it, it appears that none of the Help files were installed. I have lots and
lots of release notes, but nothing that tells me how to use it.
Could some one problem me with 1 or 2 line answer to some of these really
simple questions (which will be a really good headstart).
1. Online documentation
I went here: http://www.informix.com/documentation/
But I got lost in install pages, can somebody provide a link to the online
docs (for example, admin guide, getting started, ...)
2. I am very familiar with databases, have used Oracle, Sybase, IBM and
Microsoft.
How do I write a SQL script and run it against the database?
MSS has ISQL.exe -i file_name
IBM - db2 command
How do you call the command line tool to run a script for Informix?
3. How to to embedded multiple statements...
Some tools use semi-colons, Sybase and MSS use "go"
creat table dave (c1 int);
insert into dave values (1);commit
4. Are stored procedures and triggers supported, does anyone have a quick
example (or help file location).
5. How do you specify column defaults...
create table dave (
id integer default autoincrement,
last_modified timestamp default timestamp,
primary key (id)
);
How would you do the above in Informix, autoincrement will insert a (MAX +
1) automatically for you.
last_modified will automatically default to todays date.
Thanks for any help.
Dave
1) http://www.informix.com/answers/english/pids92.htm
2) dbaccess
3) semi colon and select run(in the menu...)
4) supported (Follow the above link and check SQL manual)
5) create table dave (
id serial,
last_modified default today,
primary key (id)
);
and 'insert into dave(id) values (0).
Wish this helps you
"newswest.sybase.com" wrote:
> Unfortunately, after I installed informix on my laptop to learn how to use
> it, it appears that none of the Help files were installed. I have lots and
> lots of release notes, but nothing that tells me how to use it.
>
> Could some one problem me with 1 or 2 line answer to some of these really
> simple questions (which will be a really good headstart).
>
> 1. Online documentation
> I went here: http://www.informix.com/documentation/
> But I got lost in install pages, can somebody provide a link to the online
> docs (for example, admin guide, getting started, ...)
>
> 2. I am very familiar with databases, have used Oracle, Sybase, IBM and
> Microsoft.
> How do I write a SQL script and run it against the database?
> MSS has ISQL.exe -i file_name
> IBM - db2 command
>
> How do you call the command line tool to run a script for Informix?
>
> 3. How to to embedded multiple statements...
> Some tools use semi-colons, Sybase and MSS use "go"
> creat table dave (c1 int);
> insert into dave values (1);> commit
>
> 4. Are stored procedures and triggers supported, does anyone have a quick
> example (or help file location).
>
> 5. How do you specify column defaults...
> create table dave (
> id integer default autoincrement,
> last_modified timestamp default timestamp,
> primary key (id)
> );>
> How would you do the above in Informix, autoincrement will insert a (MAX +
> 1) automatically for you.
> last_modified will automatically default to todays date.
>
> Thanks for any help.
> Dave
5) create table dave (
id serial,
last_modified date default today,
primary key (id)
);
and 'insert into dave(id) values (0).
Ooops, Sorry :-)
"Yang, Heung-Soon" wrote:
> 1) http://www.informix.com/answers/english/pids92.htm
> 2) dbaccess
> 3) semi colon and select run(in the menu...)
> 4) supported (Follow the above link and check SQL manual)
> 5) create table dave (
> id serial,
> last_modified default today,
> primary key (id)
> );
> and 'insert into dave(id) values (0).
>
> Wish this helps you
>
>
> "newswest.sybase.com" wrote:
>
>> Unfortunately, after I installed informix on my laptop to learn how
>> to use
>> it, it appears that none of the Help files were installed. I have
>> lots and
>> lots of release notes, but nothing that tells me how to use it.
>>
>> Could some one problem me with 1 or 2 line answer to some of these
>> really
>> simple questions (which will be a really good headstart).
>>
>> 1. Online documentation
>> I went here: http://www.informix.com/documentation/
>> But I got lost in install pages, can somebody provide a link to the
>> online
>> docs (for example, admin guide, getting started, ...)
>>
>> 2. I am very familiar with databases, have used Oracle, Sybase, IBM
>> and
>> Microsoft.
>> How do I write a SQL script and run it against the database?
>> MSS has ISQL.exe -i file_name
>> IBM - db2 command
>>
>> How do you call the command line tool to run a script for Informix?
>>
>> 3. How to to embedded multiple statements...
>> Some tools use semi-colons, Sybase and MSS use "go"
>> creat table dave (c1 int);
>> insert into dave values (1);>> commit
>>
>> 4. Are stored procedures and triggers supported, does anyone have a
>> quick
>> example (or help file location).
>>
>> 5. How do you specify column defaults...
>> create table dave (
>> id integer default autoincrement,
>> last_modified timestamp default timestamp,
>> primary key (id)
>> );>>
>> How would you do the above in Informix, autoincrement will insert a
>> (MAX +
>> 1) automatically for you.
>> last_modified will automatically default to todays date.
>>
>> Thanks for any help.
>> Dave
>
"newswest.sybase.com" wrote:
>
> Unfortunately, after I installed informix on my laptop to learn how to use
> it, it appears that none of the Help files were installed. I have lots and
> lots of release notes, but nothing that tells me how to use it.
>
> Could some one problem me with 1 or 2 line answer to some of these really
> simple questions (which will be a really good headstart).
>
> 1. Online documentation
> I went here: http://www.informix.com/documentation/
> But I got lost in install pages, can somebody provide a link to the online
> docs (for example, admin guide, getting started, ...)
www.informix.com/answers and follow the links. The docs are PDF files and
you can download them for local access (which generally works better as
acrobat is not great at dealing with large docs online).
> 2. I am very familiar with databases, have used Oracle, Sybase, IBM and
> Microsoft.
> How do I write a SQL script and run it against the database?
> MSS has ISQL.exe -i file_name
> IBM - db2 command
>
> How do you call the command line tool to run a script for Informix?
Dbaccess is the database user's utility. It has two modes, menu mode, and
commandline mode. Menu mode is invoked by typing 'dbaccess' alone or
followed by a databasename only. Thus:
dbaccess
-or-dbaccess mydatabase
If the database name is followed by a filename that file's contents are
executes as SQL statements, so:
dbaccess mydatabase some_sql_script.sql
Commandline mode is invoked by appending a dash argument after the
database on the command line. The prompt is '> ', so:
dbaccess mydatabase -
> ^D^D
Two ctrl-D's end the session if a database was selected on the commandline
and only one is needed if the databasename was '-' (used to open a session
for a CREATE DATABASE statement). You can redirect scripts or here
documents using this method, thus:
dbaccess mydatabase - <some_sql_script.sql
echo "select * from mytable;" | dbaccess mydatabase -
dbaccess mydatabase - <<EOF
select * from mytable;
select count(*) from mytable;EOF
> 3. How to to embedded multiple statements...
> Some tools use semi-colons, Sybase and MSS use "go"
> creat table dave (c1 int);
> insert into dave values (1);> commit
Informix uses the semi-colon as in the examples above, as a command
terminator (not separator).
> 4. Are stored procedures and triggers supported, does anyone have a quick
> example (or help file location).
Yes. The manual: "Guide to SQL: Syntax" contains the syntax of Informix
SPL (Stored Procedure Language). It is not as rich as Oracle PLSQL
because Informix has the ISQL Perform report writter and 4GL languages for
creating simple applications and intends Stored Procedures for canning
queries not application modules.
> 5. How do you specify column defaults...
> create table dave (
> id integer default autoincrement,
> last_modified timestamp default timestamp,
> primary key (id)
> );
create table dave (
id serial not null,
last_modified datetime year to second default current year to second,
...,
primary key (id)
);
The last_modified default will place the current date and time in the
column at insert time if nothing is inserted. To maintain that column at
update time you will need to add an update trigger keyed to the other
columns (you cannot update a triggering column in an update trigger).
> How would you do the above in Informix, autoincrement will insert a (MAX +
> 1) automatically for you.
> last_modified will automatically default to todays date.
Just insert zero (0) into the column, id, and the engine will replace it
with that table's current serial number which automatically increments.
SERIAL type columns are type INTEGER, if you need more than 2^31 serial
values you need IDS.2000 which supports LONG SERIAL columns. The inserted
serial number is accessible in the sqlca data structure (in 4GL or ESQL/C)
in the field sqlca.sqlerrd[1] (or sqlca.sqlerrd[2] in 4GL) or from the
DBINFO function by selecting DBINFO('sqlca.sqlerrd1') immediately after
the INSERT statement.
Art S. Kagel