Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Shell script to execute Oracle procedure and trigerring email on success and failure Post 303042687 by rbatte1 on Friday 3rd of January 2020 12:23:19 PM
Old 01-03-2020
Yes, the value of outvar will just hold all the content of your file. You might prefer to process the variable or create another by reading the file in a different way. It's up to you, but you can use many ways to read specific things. For example:-
  • To read the 3rd line, this would do sed -n3p This could be written as third_line="$(printf "%s" "${outvar}" | sed -n3p)" or third_line="$(sed -n3p filename)" depending
  • To set a value if your file is null, you could [ ! -s filename ] && variable=0
  • To set a value if your variable is null, you could [ -z "${outvar}" ] && outvar=0
  • To scan for non-numerics and set the value to zero, you could attack it in several ways, e.g. delete the digits from the string and see if there's anything left; try to add zero and check the return code (writing all output/error messages to /dev/null to keep it clean) etc. etc. It depends what makes sense to you.


Does this help you sanity check your data?



Robin
This User Gave Thanks to rbatte1 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute an Oracle stored procedure from a shell scrip

Here is a snippet of my code: if then echo "\n Deleting all reports older than 24 hours. \n" >> $logfile ls -l $FileName >> $logfile ... (1 Reply)
Discussion started by: mh53j_fe
1 Replies

2. Shell Programming and Scripting

run shell script from oracle store procedure

hi, this is urgent..can i run a shell script from store procedure without using java. (8 Replies)
Discussion started by: arnabb4u
8 Replies

3. Shell Programming and Scripting

Calling an Oracle Stored Procedure from Unix shell script

hai, can anybody say how to call or to execute an oracle stored procedure in oracle from unix... thanks in advance.... for ur reply.... by, leo (2 Replies)
Discussion started by: Leojhose
2 Replies

4. Shell Programming and Scripting

How to execute an Oracle procedure using shell

Hi , i have created an .sh file that has the following code: #!/bin/ksh sqlplus -s p1istuat/p1istuat@CWS_IST6 @Procedure_Execute.sql & sqlplus -s p1istuat/p1istuat@CWS_IST6 << EOF exit EOF The mentioned Procedure_Execute.sql file inside has the following code: exec TEST; ... (5 Replies)
Discussion started by: vins_san
5 Replies

5. Shell Programming and Scripting

Invoking Oracle stored procedure in unix shell script

Here's a shell script snippet..... cd $ORACLE_HOME/bin Retval=`sqlplus -s <<eof $TPDB_USER/april@$TPD_DBCONN whenever SQLERROR exit 2 rollback whenever OSERROR exit 3 rollback set serveroutput on set pages 999 var status_desc char(200) var status_code... (1 Reply)
Discussion started by: hidnana
1 Replies

6. Shell Programming and Scripting

Shell Script for call a procedure in Oracle DB

Hi everyone! I'm new with Shell Scripting, and I have to do a shell script to call a procedure, which have 2 input parameters, the directory(from server) and the txt file (which have informations to update/insert in DB). I have to create a shell script to execute that procedure for each txt... (5 Replies)
Discussion started by: renatoal
5 Replies

7. Shell Programming and Scripting

How to execute the stored procedure from shell script

How to execute the stored procedure from shell script and is there any possibility to print the dbms output in a log file. (2 Replies)
Discussion started by: dineshmurs
2 Replies

8. Shell Programming and Scripting

Execute a shell script from Oracle procedure

Hi Gurus, Want to execute a shell script from a oracle procedure and get the status of the same, any assistance in this regard will be appreciated. proc_data.sh is script name which I want to execute from oracle procedure It should work something like below procedure test begin... (1 Reply)
Discussion started by: palanisvr
1 Replies

9. Shell Programming and Scripting

Why i can't execute the procedure in shell script?

i have the following code inside a shell script .prog in oracle server when i call the program DBMS_OUTPUT.PUT_LINE(x_return_status|| ln_rep_req_id); will return 0 , it is very strange , i try to submit the concurrent request in oracle , and it can successfully executed, what am i missing ? i... (1 Reply)
Discussion started by: feilhk
1 Replies

10. Shell Programming and Scripting

Execute Oracle gather stats via shell script

Hi , I am trying to automate a gather stats in shell script #!/usr/bin/ksh export ORACLE_HOME=/orcl/app/oracle/product/11.2.0.1/db_1 export PATH="$PATH:$ORACLE_HOME/bin" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ORACLE_HOME/lib32" export TNS_ADMIN=/opt/netprobe/config... (1 Reply)
Discussion started by: neil.k
1 Replies
table(3snmp)							     net-snmp							      table(3snmp)

NAME
table - Helps you implement a table. Modules table_array Helps you implement a table when data can be stored locally. table_container Helps you implement a table when data can be found via a netsnmp_container. table_data Helps you implement a table with datamatted storage. generic_table_API General requirements for a table helper. table_iterator The table iterator helper is designed to simplify the task of writing a table handler for the net-snmp agent when the data being accessed is not in an oid sorted form and must be accessed externally. table_row Helps you implement a table shared across two or more subagents, or otherwise split into individual row slices. tdata Implement a table with datamatted storage. Defines #define SPARSE_TABLE_HANDLER_NAME 'sparse_table' Functions netsnmp_mib_handler * netsnmp_get_table_handler (netsnmp_table_registration_info *tabreq) Given a netsnmp_table_registration_info object, creates a table handler. int netsnmp_register_table (netsnmp_handler_registration *reginfo, netsnmp_table_registration_info *tabreq) creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls netsnmp_register_handler() to register the table into the agent. NETSNMP_INLINE netsnmp_table_request_info * netsnmp_extract_table_info (netsnmp_request_info *request) Extracts the processed table information from a given request. netsnmp_table_registration_info * netsnmp_find_table_registration_info (netsnmp_handler_registration *reginfo) extracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object int table_helper_handler (netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) implements the table helper handler netsnmp_mib_handler * netsnmp_sparse_table_handler_get (void) create sparse table handler int netsnmp_sparse_table_register (netsnmp_handler_registration *reginfo, netsnmp_table_registration_info *tabreq) creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls netsnmp_register_handler() to register the table into the agent. int netsnmp_table_build_result (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info, u_char type, u_char *result, size_t result_len) Builds the result to be returned to the agent given the table information. int netsnmp_table_build_oid (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info) given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object. int netsnmp_table_build_oid_from_index (netsnmp_handler_registration *reginfo, netsnmp_request_info *reqinfo, netsnmp_table_request_info *table_info) given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object. int netsnmp_update_variable_list_from_index (netsnmp_table_request_info *tri) parses an OID into table indexses int netsnmp_update_indexes_from_variable_list (netsnmp_table_request_info *tri) builds an oid given a set of indexes. int netsnmp_check_getnext_reply (netsnmp_request_info *request, oid *prefix, size_t prefix_len, netsnmp_variable_list *newvar, netsnmp_variable_list **outvar) checks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value. Detailed Description Helps you implement a table. This handler helps you implement a table by doing some of the processing for you. This handler truly shows the power of the new handler mechanism. By creating a table handler and injecting it into your calling chain, or by using the netsnmp_register_table() function to register your table, you get access to some pre-parsed information. Specifically, the table handler pulls out the column number and indexes from the request oid so that you don't have to do the complex work to do that parsing within your own code. To do this, the table handler needs to know up front how your table is structured. To inform it about this, you fill in a table_registeration_info structure that is passed to the table handler. It contains the asn index types for the table as well as the minimum and maximum column that should be used. Function Documentation int netsnmp_check_getnext_reply (netsnmp_request_info * request, oid * prefix, size_t prefix_len, netsnmp_variable_list * newvar, netsnmp_variable_list ** outvar) checks the original request against the current data being passed in if its greater than the request oid but less than the current valid return, set the current valid return to the new value. returns 1 if outvar was replaced with the oid from newvar (success). returns 0 if not. Definition at line 881 of file table.c. NETSNMP_INLINE netsnmp_table_request_info* netsnmp_extract_table_info (netsnmp_request_info * request) Extracts the processed table information from a given request. Call this from subhandlers on a request to extract the processed netsnmp_request_info information. The resulting information includes the index values and the column number. Parameters: request populated netsnmp request structure Returns: populated netsnmp_table_request_info structure Definition at line 125 of file table.c. netsnmp_table_registration_info* netsnmp_find_table_registration_info (netsnmp_handler_registration * reginfo) extracts the registered netsnmp_table_registration_info object from a netsnmp_handler_registration object Definition at line 134 of file table.c. netsnmp_mib_handler* netsnmp_get_table_handler (netsnmp_table_registration_info * tabreq) Given a netsnmp_table_registration_info object, creates a table handler. You can use this table handler by injecting it into a calling chain. When the handler gets called, it'll do processing and store it's information into the request->parent_data structure. The table helper handler pulls out the column number and indexes from the request oid so that you don't have to do the complex work of parsing within your own code. Parameters: tabreq is a pointer to a netsnmp_table_registration_info struct. The table handler needs to know up front how your table is structured. A netsnmp_table_registeration_info structure that is passed to the table handler should contain the asn index types for the table as well as the minimum and maximum column that should be used. Returns: Returns a pointer to a netsnmp_mib_handler struct which contains the handler's name and the access method Definition at line 85 of file table.c. int netsnmp_register_table (netsnmp_handler_registration * reginfo, netsnmp_table_registration_info * tabreq) creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls netsnmp_register_handler() to register the table into the agent. Definition at line 108 of file table.c. netsnmp_mib_handler* netsnmp_sparse_table_handler_get (void) create sparse table handler Definition at line 722 of file table.c. int netsnmp_sparse_table_register (netsnmp_handler_registration * reginfo, netsnmp_table_registration_info * tabreq) creates a table handler given the netsnmp_table_registration_info object, inserts it into the request chain and then calls netsnmp_register_handler() to register the table into the agent. Definition at line 733 of file table.c. int netsnmp_table_build_oid (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info) given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object. Index values are extracted from the table_info varbinds. Entry column Definition at line 784 of file table.c. int netsnmp_table_build_oid_from_index (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info) given a registration info object, a request object and the table info object it builds the request->requestvb->name oid from the index values and column information found in the table_info object. Index values are extracted from the table_info index oid. Definition at line 821 of file table.c. int netsnmp_table_build_result (netsnmp_handler_registration * reginfo, netsnmp_request_info * reqinfo, netsnmp_table_request_info * table_info, u_char type, u_char * result, size_t result_len) Builds the result to be returned to the agent given the table information. Use this function to return results from lowel level handlers to the agent. It takes care of building the proper resulting oid (containing proper indexing) and inserts the result value into the returning varbind. Definition at line 751 of file table.c. int netsnmp_update_indexes_from_variable_list (netsnmp_table_request_info * tri) builds an oid given a set of indexes. Definition at line 863 of file table.c. int netsnmp_update_variable_list_from_index (netsnmp_table_request_info * tri) parses an OID into table indexses Definition at line 847 of file table.c. int table_helper_handler (netsnmp_mib_handler * handler, netsnmp_handler_registration * reginfo, netsnmp_agent_request_info * reqinfo, netsnmp_request_info * requests) implements the table helper handler XXX-rks: memory leak. add cleanup handler? none available got one ok for loop Definition at line 142 of file table.c. Author Generated automatically by Doxygen for net-snmp from the source code. Version 5.4.3.pre1 23 May 2010 table(3snmp)
All times are GMT -4. The time now is 10:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy