Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

oci_num_fields(3) [php man page]

OCI_NUM_FIELDS(3)														 OCI_NUM_FIELDS(3)

oci_num_fields - Returns the number of result columns in a statement

SYNOPSIS
int oci_num_fields (resource $statement) DESCRIPTION
Gets the number of columns in the given $statement. PARAMETERS
o $statement - A valid OCI statement identifier. RETURN VALUES
Returns the number of columns as an integer, or FALSE on errors. EXAMPLES
Example #1 oci_num_fields(3) example <?php // Create the table with: // CREATE TABLE mytab (id NUMBER, quantity NUMBER); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { echo oci_field_name($stid, $i) . " " . oci_field_type($stid, $i) . "<br> "; } // Outputs: // ID NUMBER // QUANTITY NUMBER oci_free_statement($stid); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocinumcols(3) instead. This name still can be used, it was left as alias of oci_num_fields(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_NUM_FIELDS(3)

Check Out this Related Man Page

OCI_FIELD_IS_NULL(3)													      OCI_FIELD_IS_NULL(3)

oci_field_is_null - Checks if a field in the currently fetched row is NULL

SYNOPSIS
bool oci_field_is_null (resource $statement, mixed $field) DESCRIPTION
Checks if the given $field from the current row of $statement is NULL. PARAMETERS
o $statement - A valid OCI statement identifier. o $field - Can be the field's index (1-based) or name. RETURN VALUES
Returns TRUE if $field is NULL, FALSE otherwise. EXAMPLES
Example #1 oci_field_name(3) example <?php // Create the table with: // CREATE TABLE mytab (c1 NUMBER); // INSERT INTO mytab VALUES (1); // INSERT INTO mytab VALUES (NULL); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid); while (($row = oci_fetch_array($stid, OCI_RETURN_NULLS)) != false) { $ncols = oci_num_fields($stid); for ($col = 1; $col <= $ncols; $col++) { var_dump(oci_field_is_null($stid, $col)); } } // Outputs: // bool(false) // bool(true) oci_free_statement($stid); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocicolumnisnull(3) instead. This name still can be used, it was left as alias of oci_field_is_null(3) for downwards compatability. This, however, is deprecated and not recommended. PHP Documentation Group OCI_FIELD_IS_NULL(3)
Man Page

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

setting width in echo statement

Hello All, I need to set the width or number of columns for my dynamic output in the echo statement. statement is like: echo " <output> " here the <output> is dyamice and can be of any number of characters, the " " should always start in same column everytime it is... (4 Replies)
Discussion started by: s123.radha
4 Replies

2. Shell Programming and Scripting

removing pattern which is spread in multiple lines

I have several huge files wich contains oracle table creation scripts as follows: I would need to remove the pattern colored in red above. Any sed/awk/pearl code will be of much help. Thanks (2 Replies)
Discussion started by: sabyasm
2 Replies

3. Shell Programming and Scripting

nestes 'if' statement

Once more a very beginners question: what is wrong in my second 'if' statement? # my shell arguments NB_ARGS=$# ARGS=$@ echo arguments\: $ARGS; echo # inspect arguments if ]; then echo now_in_first_if # here's line 23 if ]; then # this gives the error echo... (2 Replies)
Discussion started by: MarkZWEERS
2 Replies

4. Shell Programming and Scripting

Loop problem

Hi, I faced a problem when I try to populate a database using the following script DECLARE a NUMBER := 1; b NUMBER := 91317010001; c NUMBER := 1; BEGIN WHILE a < 5001 LOOP insert into RGC_IMS_REGISTRATION (IMSRegId, Type, IMPI, IMPU, CP_ID, Location_For_Registration,... (1 Reply)
Discussion started by: sukumarm2008
1 Replies

5. Shell Programming and Scripting

check number or character of a file

Hi, Please see the below information. 1. Read files one by one and run the script. 2. Check if the filename is CHARTER OR NUMBER 3. Run the case statement. I have files in the folder. i will get 300 files in a single day. Abc_111111111111.csv 101010_kkk_bbbb.csv... (6 Replies)
Discussion started by: onesuri
6 Replies

6. Programming

IF && statement problem

Hello there, My first time on the forums, glad to be here :) I'm completely new to programming in PHP and I have a question which I hope someone could help me with. I am currently using this statement: if(($session == 2) && ($item == Dagger) && ($item2 == Dagger)){ ... (5 Replies)
Discussion started by: Hero
5 Replies

7. Shell Programming and Scripting

Help with a simple function

Hi there Everytime it calls the second if statement it keeps calling the first echo message from the first if statement. how do I get it to display the second echo message in the second if statement? Thanks. function (verbose) { if ; then echo "rm: cannot remove $1 : is a... (8 Replies)
Discussion started by: bob21
8 Replies

8. UNIX for Dummies Questions & Answers

How to extract a number from a statement?

Hi, i want to extract a number from a statement. 03/07/14 00:58:41 CRPr::CopyTotable inserted 3501 rows into table Now i want to assign 3501 to a variable. This number may change every time. (5 Replies)
Discussion started by: arghadeep adity
5 Replies