Jump to content

How to describe a table: OCI


dvd420

Recommended Posts

Hi,

 

I want to describe a table. oci_execute() is not taking "DESC[RIBE]" as a valid query. So, I am using the following code for it:

 

But I am unable to detremine if a field is NULL or NOT NULL.

 

oci_field_is_null() is returning FALSE always.

 

function desc_table($conn, $tab)

{

$stid = oci_parse($conn, "SELECT * FROM $tab");

$r = oci_execute($stid, OCI_DEFAULT);

 

if (!$r)

{

$e = oci_error($stid);

print $e['message'];

}

else

{

$ncols = oci_num_fields($stid);

for ($i = 1; $i <= $ncols; $i++)

{

$column_name = oci_field_name($stid, $i);

$column_type = oci_field_type($stid, $i);

$column_size = oci_field_size($stid, $i);

$column_nvl  = oci_field_is_null($stid, $i);

 

// Print ....

}

}

}

 

Link to comment
https://forums.phpfreaks.com/topic/140119-how-to-describe-a-table-oci/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.