Friday, January 19, 2018

Unix script to extract File Name and Base Path from File Path

$ VAR=/home/me/mydir/file.c
$ DIR=$(dirname "${VAR}")
$ echo "${DIR}"
/home/me/mydir
$ basename "${VAR}"
file.c

Thursday, January 4, 2018

PLSQL Table Type

Hi , Some time we may need to process a table of records for which you might need to create a temporary table to process the records.

To avoid SQL Table we can use PLSQL table as given below

DECLARE
   TYPE t_record IS TABLE OF VARCHAR (30);
   TYPE t_tab IS TABLE OF t_record;

   v_tab   t_tab := t_tab ( t_record ('1', '2', '3')

                          , t_record ('A', 'B', 'C')
                          );
BEGIN
   FOR i IN 1 .. v_tab.COUNT
   LOOP
      DBMS_OUTPUT.put_line (v_tab (i) (1) || v_tab (i) (2) || v_tab (i) (3));
   END LOOP;
END;
/