Re: [Pro*C/C++] : List of tables in database and other things
Date: Mon, 11 Oct 1999 04:38:05 GMT
Message-ID: <NQdM3.28393$48.670518_at_news2.rdc1.on.home.com>
Hi.
> ---------- 1. tables in database ---------------
> 1.1. How can we know if a table (for instance, table "AAA") exists in
database?
> 1.2. How can we get number of tables containing in database?
> 1.3. How can we get list of names of all tables containing in database?
Couldn't you select the information from ALL_TABLES?
> ---------- 2. columns in table -----------------
> 2.1. How can we know if a column (for instance, column "BBB") exists in
table?
> 2.2. How can we get number of columns containing in table?
> 2.3. How can we get list of names of all columns containing in table?
Couldn't you select the information from ALL_SOURCE?
> ---------- 3. rows in table --------------------
> 3.1. How can we know if a row (for instance, row with specific key) exists
in table?
> 3.2. How can we get number of rows containing in table?
> 3.3. How can we get list of names of all rows containing in table?
Wouldn't this be a usual select statement? Or, do you need to know the syntax for a proC select?
For example, you could either:
- EXEC SQL SELECT COUNT(*) INTO :ilRowCount FROM TABLE1;
- char lsSQLStatement[50]; int liRowCount;
strcpy(lsSQLStatement, "SELECT COUNT(*) FROM TABLE1"); EXEC SQL PREPARE sSQL FROM :lsSQLStatement; EXEC SQL DECLARE lcurCursor for sSQL; EXEC SQL OPEN lcurCursor; EXEC SQL WHENEVER NOT FOUND DO break; for (;;) { EXEC SQL FETCH lcurCursor into :liRowCount; } EXEC SQL CLOSE lcurCursor;
Hope it helps.
C Received on Mon Oct 11 1999 - 06:38:05 CEST