tailieunhanh - Mastering unix shell scripting p5

Như bạn có thể thấy trong Ví dụ 9,6, điều này là không nhiều của một truy vấn, nhưng nó là tất cả những gì chúng ta cần. Kịch bản này SQL, , được sử dụng trong các chức năng sqlplus trong Ví dụ 9,7. | 258 Chapter 9 As you can see in Listing this is not much of a query but it is all that we need. This SQL script is used in the sqlplus function in Listing . Notice in this function simple_SQL_query that the sqlplus command statement requires a username password and an Oracle SID name to work. See the function code in Listing . function simple_SQL_query USER oracle PASSWD oracle SID yogidb sqlplus USER PASSWD @ SID @ Listing simple_SQL_query function listing. The function shown in Listing can be shortened further if you are logged in to the system as the oracle user or executing a script as the oracle user. If these conditions are met then you can run a simpler version of the previous sqlplus as shown in Listing with the output of the query however the Oracle Listener is not tested as in the previous sqlplus statement in Listing . The sqlplus command in Listing should be run on the local machine. oracle@yogi sqlplus @ usr local bin SQL Plus Release - Production on Wed Aug 7 16 07 30 2002 c Copyright 2000 Oracle Corporation. All rights reserved. Connected to Oracle8i Enterprise Edition Release - Production With the Partitioning option JServer Release - Production USERNAME USER_ID ACCOUNT_STATUS LOCK_DATE EXPIRY_DATE DEFAULT_TABLESPACE TEMPORARY_TABLESPACE CREATED INITIAL_RSRC_CONSUMER_GROUP Listing Example of an SQL Oracle query. Monitoring Processes and Applications 259 EXTERNAL_NAME OPS ORACLE 940 OPEN USERS TEMP 18-APR-2002 Disconnected from Oracle8i Enterprise Edition Release -Production With the Partitioning option JServer Release - Production Listing Example of an SQL Oracle query. continued This is about as simple as it gets You can check the return code from the sqlplus command shown in Listing . If it is zero then the query worked. If the return code is nonzero then the query failed and the database should be considered .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
6    139    0    29-06-2024