unix and linux commands - unix shell scripting

On ROWNUM and Limiting Results


 
Thread Tools Search this Thread
# 1  
Old 04-06-2008
On ROWNUM and Limiting Results

Our technologist explains how ROWNUM works and how to make it work for you.

More...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Limiting the Script

Greetings. I have script to monitor the disk space of folder it runs every 17 min with help of cron. It sends email when disk size reaches to 85 %. Now the issue is that it continousely generates email until we clear some space in that folder. Is it possible to restrict the Script to send only... (14 Replies)
Discussion started by: manju98458
14 Replies

2. UNIX for Advanced & Expert Users

Limiting access to postqueue

Hi, I have a Debian 6 machine running Postfix 2.7.1. The email server works pretty well. I discovered that any non-root user can access to the mail queue using postqueue command just like root. How can I limit this access? (1 Reply)
Discussion started by: mjdousti
1 Replies

3. Solaris

Limiting Connections from a single IP

I'm looking for a way to limit connections to a Solaris 10 box from any single IP. The problem is that I've had more experience doing this with IPTables on Linux, rather than with IPFilter, which I've found to be somewhat feature-poor. I hope there is some way to do this using IPFilter, I've... (2 Replies)
Discussion started by: spynappels
2 Replies

4. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

5. Shell Programming and Scripting

Replace first field with Rownum in a file

Hi, I've a file which is "|" delimited. I want to replace the first field with rownum, how can I do it with awk or sed command? There is no header record. sample file 1195|ABC|DEF|30 LATE DR||CHARLOTTE|NC||NONE@NONE.COM|I|1 1227|PQR|STU|3 KING DR||LIVONIA|NJ|481524071|YAHOO@YAHOO.COM|I|3... (4 Replies)
Discussion started by: rudoraj
4 Replies

6. Solaris

Limiting number of processors used by an application

Hello, Using a Solaris SunOS 5.10, is there anyway to limit the number of processors utilised by an external vendor application over the server, from the unix OS perspective? (1 Reply)
Discussion started by: pgop
1 Replies

7. HP-UX

Limiting SFTP Users While Not Limiting Regular Users?

Hi, I have searched the web and have come back with nothing that is satisfactory for what I require. SFTP is my corporations new file transfer standard. What I require is a method to lock down SFTP users to their directory (they may go to sub directories) while not restricting regular users. ... (2 Replies)
Discussion started by: Emancipator
2 Replies

8. HP-UX

limiting failed logins to three

I have tried limiting failed logins to three by the following method logins -ox \ | awk -F: '($8 != "LK" && $1 != "root") { print $1 }' \ | while read logname; do /usr/lbin/modprpw -m umaxlntr=3 "$logname" done /usr/lbin/modprdef -m umaxlntr=3 but it is failing on the 4th... any ideas?... (1 Reply)
Discussion started by: csaunders
1 Replies

9. Cybersecurity

Problem with limiting logins to one in AIX 5.3

I am migrating from 5.2 to 5.3 AIX. In previous versions of AIX, including 5.2, I've been able to limit user's logins to 1 by using the following script named Block_user: #!/bin/ksh USER=$1 NUM=`who | grep $USER | cut -c1-8 | wc -l` #The above ' is not a single quote but back quote if ]... (2 Replies)
Discussion started by: Confused_lulu
2 Replies

10. UNIX for Dummies Questions & Answers

Limiting access

Hi, I'm new to linux and unix, and i have couple of problems: 1) how can i limit the access for a user, for example, i created a user, and i want that this user will be able to be only in one directory, and will see only the files i want him to. 2) I have a domain name, and i want that every... (4 Replies)
Discussion started by: misha
4 Replies
Login or Register to Ask a Question
OCI_FETCH_ALL(3)														  OCI_FETCH_ALL(3)

oci_fetch_all - Fetches multiple rows from a query into a two-dimensional array

SYNOPSIS
int oci_fetch_all OCI_FETCHSTATEMENT_BY_COLUMN OCI_ASSOC (resource $statement, array &$output, [int $skip], [int $maxrows = -1], [int $flags = + ]) DESCRIPTION
Fetches multiple rows from a query into a two-dimensional array. By default, all rows are returned. This function can be called only once for each query executed with oci_execute(3). PARAMETERS
o $statement -A valid OCI8 statement identifier created by oci_parse(3) and executed by oci_execute(3), or a REF CURSOR statement identifier. o $output - The variable to contain the returned rows. LOB columns are returned as strings, where Oracle supports conversion. See oci_fetch_array(3) for more information on how data and types are fetched. o $skip - The number of initial rows to discard when fetching the result. The default value is 0, so the first row onwards is returned. o $maxrows - The number of rows to return. The default is -1 meaning return all the rows from $skip + 1 onwards. o $flags - Parameter $flags indicates the array structure and whether associative arrays should be used. oci_fetch_all(3) Array Structure Modes +-----------------------------+---------------------------------------------------+ | Constant | | | | | | | Description | | | | +-----------------------------+---------------------------------------------------+ | | | | OCI_FETCHSTATEMENT_BY_ROW | | | | | | | The outer array will contain one sub-array per | | | query row. | | | | | | | |OCI_FETCHSTATEMENT_BY_COLUMN | | | | | | | The outer array will contain one sub-array per | | | query column. This is the default. | | | | +-----------------------------+---------------------------------------------------+ Arrays can be indexed either by column heading or numerically. Only one index mode will be returned. oci_fetch_all(3) Array Index Modes +----------+---------------------------------------------------+ |Constant | | | | | | | Description | | | | +----------+---------------------------------------------------+ | | | | OCI_NUM | | | | | | | Numeric indexes are used for each column's array. | | | | | | | |OCI_ASSOC | | | | | | | Associative indexes are used for each column's | | | array. This is the default. | | | | +----------+---------------------------------------------------+ Use the addition operator "+" to choose a combination of array structure and index modes. Oracle's default, non-case sensitive column names will have uppercase array keys. Case-sensitive column names will have array keys using the exact column case. Use var_dump(3) on $output to verify the appropriate case to use for each query. Queries that have more than one column with the same name should use column aliases. Otherwise only one of the columns will appear in an associative array. RETURN VALUES
Returns the number of rows in $output, which may be 0 or more, or FALSE on failure. EXAMPLES
Example #1 oci_fetch_all(3) example <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, 'SELECT POSTAL_CODE, CITY FROM locations WHERE ROWNUM < 3'); oci_execute($stid); $nrows = oci_fetch_all($stid, $res); echo "$nrows rows fetched<br> "; var_dump($res); // var_dump output is: // 2 rows fetched // array(2) { // ["POSTAL_CODE"]=> // array(2) { // [0]=> // string(6) "00989x" // [1]=> // string(6) "10934x" // } // ["CITY"]=> // array(2) { // [0]=> // string(4) "Roma" // [1]=> // string(6) "Venice" // } // } // Pretty-print the results echo "<table border='1'> "; foreach ($res as $col) { echo "<tr> "; foreach ($col as $item) { echo " <td>".($item !== null ? htmlentities($item, ENT_QUOTES) : "")."</td> "; } echo "</tr> "; } echo "</table> "; oci_free_statement($stid); oci_close($conn); ?> Example #2 oci_fetch_all(3) example with OCI_FETCHSTATEMENT_BY_ROW <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, 'SELECT POSTAL_CODE, CITY FROM locations WHERE ROWNUM < 3'); oci_execute($stid); $nrows = oci_fetch_all($stid, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW); echo "$nrows rows fetched<br> "; var_dump($res); // Output is: // 2 rows fetched // array(2) { // [0]=> // array(2) { // ["POSTAL_CODE"]=> // string(6) "00989x" // ["CITY"]=> // string(4) "Roma" // } // [1]=> // array(2) { // ["POSTAL_CODE"]=> // string(6) "10934x" // ["CITY"]=> // string(6) "Venice" // } // } oci_free_statement($stid); oci_close($conn); ?> Example #3 oci_fetch_all(3) with OCI_NUM <?php $conn = oci_connect('hr', 'welcome', 'localhost/XE'); if (!$conn) { $e = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $stid = oci_parse($conn, 'SELECT POSTAL_CODE, CITY FROM locations WHERE ROWNUM < 3'); oci_execute($stid); $nrows = oci_fetch_all($stid, $res, null, null, OCI_FETCHSTATEMENT_BY_ROW + OCI_NUM); echo "$nrows rows fetched<br> "; var_dump($res); // Output is: // 2 rows fetched // array(2) { // [0]=> // array(2) { // [0]=> // string(6) "00989x" // [1]=> // string(4) "Roma" // } // [1]=> // array(2) { // [0]=> // string(6) "10934x" // [1]=> // string(6) "Venice" // } // } oci_free_statement($stid); oci_close($conn); ?> NOTES
Note Using $skip is very inefficient. All the rows to be skipped are included in the result set that is returned from the database to PHP. They are then discarded. It is more efficient to use SQL to restrict the offset and range of rows in the query. See oci_fetch_array(3) for an example. Note Queries that return a large number of rows can be more memory efficient if a single-row fetching function like oci_fetch_array(3) is used. Note For queries returning a large number of rows, performance can be significantly improved by increasing oci8.default_prefetch or using oci_set_prefetch(3). Note Will not return rows from Oracle Database 12 c Implicit Result Sets. Use oci_fetch_array(3) instead. SEE ALSO
oci_fetch(3), oci_fetch_array(3), oci_fetch_assoc(3), oci_fetch_object(3), oci_fetch_row(3), oci_set_prefetch(3). PHP Documentation Group OCI_FETCH_ALL(3)