Saturday, November 30, 2013

PL/SQL Custom Exception Handaling


DECLARE

  v_Return VARCHAR2(5000);

  custom_exception EXCEPTION;

BEGIN

  v_Return := 'A';
  
  
  IF v_Return = 'A' THEN
    RAISE custom_exception;
  END IF;

EXCEPTION
  WHEN custom_exception THEN
    DBMS_OUTPUT.PUT_LINE('error');
  
END;

Thursday, November 28, 2013

Script to Create PL/SQL Pakcgage

Creating pl/sql package has two simple step . First create package name and needed function/procedure declaration .
CREATE OR REPLACE PACKAGE XML_PARSER AS
  
   FUNCTION PARSE_ACCOUNT_INFO RETURN VARCHAR2;
    
END XML_PARSER;
/

Second Step : Creating package body with actual implementation of function/procedure previously defined in creation of package.
CREATE OR REPLACE PACKAGE BODY XML_PARSER AS

  FUNCTION PARSE_ACCOUNT_INFO RETURN VARCHAR2 IS 
    TEMP VARCHAR2(10);
    BEGIN
      NULL;
    END;


END XML_PARSER;
/



Monday, November 18, 2013

The TCS Story and Beyond

Author: S. Ramadorai
Publisher: Portfolio (2013)  
On the last moment before leaving chennai of my official visit to there i bough this book , but my traveler mate take the book for reading in flight . Very next day i started reading the book .



Experience after reading 30 page : I was mad to complete the book.

Whatever ! content of this book is based on real life experience of a CEO who joined in a small growing company at India while has had good opportunity at west with good salary . He joined and finally retired as a CEO of that company and along this long journey that company became one of the large IT enabled service provider in market.

What one can find this book :
A young job seeker will know about the right decision about job and getting married and taking challenges.

A young engineer will know how to interact with potential clients and adopt new technology.

Its a must read book for any new entrepreneur.

A must book read book for software engineer .

The story of IT market expansion and adoption of new technology and solution are represented here with beauty.

One can find design strategy and industry collaboration effect and impotence of R&D in every sector of technology and business  towards progress.

Create New Schema in Oracle

Step One : Create Table Space


CREATE TABLESPACE SPR_DATA  DATAFILE 
'location in local hard disk\SPR_DATA_01.DBF'
SIZE 1000M EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE     
MANAGEMENT AUTO;

Step Two: Create User

CREATE USER sprora IDENTIFIED BY "sprora" DEFAULT TABLESPACE SPR_DATE;

Step Three: Giving Permission

GRANT CONNECT TO sprora;
ALTER USER SPRORA QUOTA UNLIMITED ON SPR_DATA;
GRANT CREATE TABLE TO SPRORA;
GRANT DBA TO SPRORA; 
GRANT CREATE SESSION,CREATE TABLE,CREATE SEQUENCE,CREATE VIEW TO sprora; 
GRANT EXECUTE ON DBMS_SQLHASH TO  sprora;
GRANT EXECUTE ON DBMS_LOCK TO sprora;
GRANT DEBUG CONNECT SESSION TO sprora; 
GRANT DEBUG ANY PROCEDURE TO sprora;

Step Four: Connect as new user and create test table

CONNECT sprora/sprora
CREATE TABLE TEST (CITY varchar2(32), POPULATION number);
INSERT INTO TEST (CITY, POPULATION) values ('edmonton', 10);
INSERT INTO TEST (CITY, POPULATION) values ('vancouver', 20);
COMMIT;

Now test newly created table using select query :
SELECT * FROM TEST