Learn Oracle Database from the Best Tutors
Search in
Answered on 26/03/2021 Learn Oracle Database
Sandeep Tiwari
Physics Lecturer with 5 years of experience in IIT-JEE & NEET, CBSE, HSC
Asked on 15/11/2017 Learn Oracle 11g DBA
Asked on 15/11/2017 Learn Oracle 11g DBA
Learn Oracle Database from the Best Tutors
Lesson Posted on 29/09/2017 Learn Oracle 10g DBA
Basic understanding of DBMS and RDBMS and Database and its Architecture
Ghanshyam M
I am Consultant and Trainer, with over 7 years of experience as Oracle Technical Consultant and trainer...
What is Data:-
The data is stored representation of objects and events which has the meaning .It can be structured or unstructured.
What is Information:-It is the data in the processed form which will increase the knowledge of end user.
What is Metadata:-It is the data which describes the properties or characteristics of the user data and its context.
What is database:-Database is the collection of data in one or more data file.
DBMS:-Database management system is the software which is used to create or manage the database and provides the controlled access to the database.
Database from Oracle point of View:-Database is the collection of data in one or more data file.
It is the collection of Logical structure and Physical Structure which are configured to maintain the integrity of the system.
Logical structured:-In the database State, The Logical structured are the representation of the actual metadata which are in the form of Table space, data dictionary.
Table space:- It is invisible in nature and bridge between the oracle database and Data File structure.
Data dictionary: - It is also a logical structure which basically captures the metadata of the Objects.
Physical Structure: - In the database State, The Physical structure are in the form of Table,synonym,view etc.
read lessAsked on 05/09/2017 Learn Oracle 10g DBA
Lesson Posted on 23/08/2017 Learn SQL Programming
Virtual (Derived) Column: Oracle 11g R1 (Part 1)
Arun
I have more than 6 years of industry experience in Oracle sql plsql real time development and currently...
VIRTUAL OR DERIVED COLUMN
A nice feature introduced in Oracle 11gR1. Welcome to the practical analysis of various scenarios with virtual columns - introduced in 11gR1 are like normal table columns whose values are derived from other columns.
DROP TABLE t_virtual_test1 PURGE;
CREATE TABLE t_virtual_test1
(
salary NUMBER,
commission NUMBER,
total NUMBER GENERATED ALWAYS AS (salary + commission) VIRTUAL
);
INSERT INTO t_virtual_test1 (salary, commission) VALUES (10000,999);
COMMIT;
The third column (which is virtual/derived) is auto derived (not auto populated).
SELECT * FROM t_virtual_test1;
SALARY | COMMISSION | TOTAL |
10000 | 999 | 10999 |
We will see difference between auto derivation and auto population in later sections. Actually, the above logic is same as deriving values in SELECT like
SELECT salary, commission, salary + commission total FROM t_virtual_test1;
We will try out different scenarios starting with the below INSERT. Any guess about the value in the virtual column TOTAL?
INSERT INTO t_virtual_test1 (salary, commission) VALUES (20000,NULL);
COMMIT;
SELECT * FROM t_virtual_test1;
SALARY | COMMISSION | TOTAL |
Rs. 10000 | null | null |
As a developer/DBA, it is important to get to know the data dictionary details corresponding to each new concept your are learning. For virtual columns, we can check the column DATA_DEFAULT in data dictionary USER_TAB_COLUMNS
TABLE_NAME | COLUMN_NAME | DATA_TYPE | DATA_DEFAULT |
T_VIRTUAL_TEST1 | SALARY | NUMBER | null |
T_VIRTUAL_TEST1 | COMMISSION | NUMBER | null |
T_VIRTUAL_TEST1 | TOTAL | NUMBER | "SALARY"+"COMMISSION" |
* Try updating the actual columns, and when you SELECT, the virtual column value will be derived based on the new/updated/latest values in the actual columns.
UPDATE t_virtual_test1
SET commission = 111;
COMMIT;
SELECT * FROM t_virtual_test1;
* Try giving your own value for derived column. You cannot insert value for derived columns because - it is always derived.
INSERT INTO t_virtual_test1 (salary, commission, total) VALUES (10000,999,10999);
Read the error report carefully - you get so much info/clue from this report
always note the error code and error message
--ORA-54013:Insert operation disallowed on virtual columns
Same for UPDATE.
UPDATE t_virtual_test1 SET total = 4444 WHERE salary = 10000;
error - Update operation disallowed on virtual columns
* Is there any way to include derived column name in INSERT?
yes - we can use the DEFAULT keyword (DEFAULT - is a basic concept which we normally use in our DMLs to instruct Oracle to go by default settings given during table creation. Please search and learn more about default).
INSERT INTO t_virtual_test1 (salary, commission, total) VALUES (11,22,DEFAULT);
COMMIT;
Note: Using DEFAULT in UPDATE will not work for virtual columns
Above points discussed gives an overview of Virtual column. Now we will look into the optional syntax keywords and what will happen if we ignore those keywords while virtual column creation
* We can omit the datatype of virtual column - datatype is auto set based on the expression given, like (salary + commission) gives a NUMBER in below example
DROP TABLE t_virtual_test2 PURGE;
CREATE TABLE t_virtual_test2
(
salary NUMBER,
commission NUMBER,
total GENERATED ALWAYS AS (salary + commission) VIRTUAL
);
DESC t_virtual_test2
SALARY NUMBER
COMMISSION NUMBER
TOTAL NUMBER
* GENERATED ALWAYS and VIRTUAL keywords are optional
DROP TABLE t_virtual_test3 PURGE;
CREATE TABLE t_virtual_test3
(
salary NUMBER,
commission NUMBER,
total AS (salary + commission)
);
INSERT INTO t_virtual_Test3 VALUES (10000,300,default);
COMMIT;
Keep you updated in next post.
I keep my posts designed in such a way that the contents are more program oriented. The program speaks volumes. I welcome your suggestions and reviews to update my style.
read lessLearn Oracle Database from the Best Tutors
Answered on 15/09/2017 Learn Oracle Forms
Prakash Reddy
Answered on 09/10/2018 Learn Oracle Database
Neeraj Bhatia
27yrs experience Oracle Certified Cloud Fusion, EBS, ERP Professional
Lesson Posted on 25/12/2016 Learn Oracle Database
Interview questions on Packages in Oracle
Gavi Yatnalli
It's going to be a multidimensional experience when you attend the classes. Take a chance and enjoy the ride.
Let me list few standard questions asked in the interviews on plsql package.
1. Why packages are used? What are it's advantages?
2. Name few bulin-in Oracle packages.
3. Can we have a function or procedure declared in Package specification and not defined in package body and why?
4. Can we have a function or procedure not declared in Package Specs and defined in Package body alone?
5. What are private components in Plsql packages?
6. Can we have only a Package specification and no body at all? If yes, under what circumstances? Such a Package specification would be compiled without errors?
7. Can we have Package body alone and no Specs? Will it be compiled without errors?
8. What is overloading and how is it accomplished in Oracle?
9. What are restrictions on overloading?
10. What are differences between and advantages/disadvantages of stand alone and packaged procedures/Functions?
11. What is forward declaration?
12. What are the disadvantages of Pacakges?
13. What is session varibale and how is it defined in package?
14. How Packages improve or degrade performance?
15. What is pragma serially_reusable and why is it used?
These questions actually cover the entire lesson on Plsql Packages.
read less
Learn Oracle Database from the Best Tutors
Answered on 13/10/2016 Learn Oracle Database
Srijit Dutta
Expert PHP and ORACLE tutor with 7 years of experience
UrbanPro.com helps you to connect with the best Oracle Database in India. Post Your Requirement today and get connected.
Ask a Question
The best tutors for Oracle Database Classes are on UrbanPro
The best Tutors for Oracle Database Classes are on UrbanPro