Answered Questions

  • Catch (Exception)

    Why is catch (Exception) almost always a bad idea?

    Charushila Kedar

    • Oct 25th, 2011

    In try block we write the code of error occurring coding..
    To handle this error, program needs an handler to this error., So, we can handle this by using Catch handler

  • Difference between View and Stored Procedure

    What is the difference between View and Stored Procedure? Can views accept input parameters as stored procedure? If yes,how could I do that? I am new to database and working on MS SQL,if someone could suggest me good reference websites then that would be great.

    Star Read Best Answer

    Editorial / Best Answer

    atdhdrolla  

    • Member Since Mar-2007 | Jul 16th, 2008


    View - A View in simple terms is a subset of a table. It can be used to retrieve data from the tables, Insert, Update or Delete from the tables. The Results of using View are not permanently  stored in the database.

    Stored Procedure -  A stored procedure is a group of SQL statements which can be stored into the database and can be shared over the netwrok with different users.

    Leena Roja

    • Jul 9th, 2015

    Views are virtual tables or subset of permanent tables for easier access of data which is stored in multiple tables. Views contains rows, columns just like a real table. The fields in a view are noth...

    Test

    • Oct 16th, 2013

    View does not have parameters , SP can have input / output parameters . View is another way to view table data . SP is pre-compiled object which can change /add data into tables.

  • What is the main use of FOREIGN KEY?

    Star Read Best Answer

    Editorial / Best Answer

    Answered by: MANAS KUMAR ROUT ( USA ) (TCS) (Eli LILLY ) - PFIZ

    • Jul 6th, 2007


    Hey Ramesh,

    I understand your interviewer's enthusiasm to know about the Foreign Key.? See foreign key definitions says its states the relationship of one attribute(Column) of one table to the corresponding column on the other table.

    So one os a parent and other is child. PARENT is that table which holds the primary key and CHILD is table which holds the referential key. Hence every entry in the PRIMARY table is unique where as same entry might be repeating in the child table. BUT that same has to be present in the PARENT table (Primary KEY).

    Now Going by definition Foreign key can be of two types :
    ========================================
    1.? ON DELETE SET NULL
    2.? ON DELETE SET CASCADE

    DETAILS:
    =======
    On delete set null :
    =======
    When a foreign key is created by on delete set null definition then when you delete one row from the primary?column (of parent table ) , then the corresponding entry in the foreign key table (Child table ) have the value "NULL" for that particular column.


    ON Delete Set Cascade:
    ================
    When the foreign key is created by this definition then when you delete the primary column (any one row -unique data) , then the Child table forcefully deletes all the rows in the child table having same value for that particular column.


    I hope u got the crux of the Foreign key
    Thanks
    Manas Kumar Rout
    SAS Consultant
    Oracle Certified Associate
    Unix Consultant

    shweta dhumal

    • Sep 8th, 2011

    foreign key is primary key of other table. for example: 'STUDENT' is one table which stores information about students and 'SID' is primary key in that table and 'MARKS' is another table which stor...

    shweta dhumal

    • Sep 8th, 2011

    The purpose of the foreign key is to ensure referential integrity of the data. In other words, only values that are supposed to appear in the database are permitted. For example, say we have two tab...

  • What is Complex View?Where we can use?

    kranthi swaroop

    • Dec 3rd, 2011

    In simple way View is a mirror to a master table.. View are two types 1) SIMPLE View 2) COMPLEX View We will not Define anywhere SIMPLE or COMPLEX while creating a view. Depending Upon the query ...

    subhransu mohapatra

    • Nov 2nd, 2011

    It will not accept DML statement..because complex view contain multiple table...therefore oracle can't understand which data will insert or update in which table...