cbtguy_2000 (cbtguy_2000@ya hoo.com) wrote:
: Is it possible to execute the DESC tablename command using PHP to a Oracle
: DB or is that a *SQLPlus command?
Not exactly, DESCRIBE is actually a command of sqlplus.
In oracle, look up the columns in a table by SELECTing from the
USER_TAB_COLUMN S table.
Oracle has a number of tables such as that one that have data about
tables/colums/etc.
On Thu, 28 Jun 2007 23:02:02 -0700, cbtguy_2000 wrote:
Is it possible to execute the DESC tablename command using PHP to a
Oracle DB or is that a *SQLPlus command?
What SQL*Plus does is to describe a cursor. Describing USER_TAB_COLUMN S
is equivalent to describing a cursor "select * from USER_TAB_COLUMN S".
OCI8 has plenty of functions to do just that:
oci_num_fields
oci_field_name
oci_field_is_nu ll
oci_field_preci sion
oci_field_scale
oci_field_size
oci_field_type
--
The following SELECT gives the basic same info as DESCRIBE
SQLDESCRIBE BB_TAX
Name
Null? Type
----------------------------------------------------------------- --------
---------------
IDSTATE
NOT NULL NUMBER(2)
STATE
CHAR(2)
TAXRATE
NUMBER(4,3)
SQLcol column_name format a15
SQLcol data_type format a15
SQLcol nullable format a4
SQLSELECT column_name, data_type,
2 data_length, data_precision,
3 data_scale, nullable
4 FROM user_tab_column s
5 WHERE table_name = 'BB_TAX';
COLUMN_NAME DATA_TYPE DATA_LENGTH DATA_PRECISION
DATA_SCALE NULL
--------------- --------------- -----------
--------------- ---------
----
IDSTATE NUMBER 22
2 0
N
STATE CHAR 2
Y
TAXRATE NUMBER 22
4 3
Y
"Mladen Gogala" <mgogala.SPAM_M E.NOT@verizon.n etwrote in message
news:pan.2007.0 6.30.01.24.18@v erizon.net...
On Thu, 28 Jun 2007 23:02:02 -0700, cbtguy_2000 wrote:
>
>Is it possible to execute the DESC tablename command using PHP to a
>Oracle DB or is that a *SQLPlus command?
>
What SQL*Plus does is to describe a cursor. Describing USER_TAB_COLUMN S
is equivalent to describing a cursor "select * from USER_TAB_COLUMN S".
OCI8 has plenty of functions to do just that:
oci_num_fields
oci_field_name
oci_field_is_nu ll
oci_field_preci sion
oci_field_scale
oci_field_size
oci_field_type
-- http://www.mladen-gogala.com
Comment