Oracle Questions

Q:

Explain how to create users through SQL PLUS.

Answer

We need to first login to the data base as: SQLPLUS followed by user_name/password. Then we need to execute the following query:


CREATE USER user_name IDENTIFIED BY abcd; in this query a user_name suggest the user that is created which has a password abcd which is required for login in database.

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1793
Q:

What are the Advantages of PL/SQL?

Answer

- Because of the block nature, multiple statements are processed at once thereby improving performance. 


- PL/SQL handles exceptions on catching which, action can be taken. 


- PL/SQL is highly portable as it works with all procedural languages and is highly secured because of privileges.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1787
Q:

Both PL/SQL and Java (or) .NET code can be used to create Oracle stored procedures and triggers. Which of the one should be used and why?

Answer

Even though both PL/SQL and Java (or) .NET can be used, PL/SQL stands above these two in terms of integration overhead. This is because Java is an open source proprietary and Data manipulation is slightly faster in PL/SQL than in Java. 

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1764
Q:

What are joins? Explain its characteristic features .

Answer

Joins are used to combine data of one or more tables. Joins should be used when there is abundant data. Joins can be LEFT, RIGHT, OUTER, INNER or even SELF JOIN. The purpose is to bind data from multiple tables without any receptivity

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1730
Q:

What are Number Functions in SQL?

Answer

- ABS(number)

Returns the absolute positive value of an expression.
Syntax:
ABS(expression)
Example:
SELECT ABS(-1.0), ABS(0.0), ABS(1.0)
Output:
1.0    .0    1.0

- CEIL(number)

Returns the smallest integer greater than, or equal to, the specified numeric expression.
Syntax:
CEILING(expression)
Example:
SELECT CEILING($223.45), CEILING($-223.45), CEILING($0.0)
Output:
224.00    -223.00        0.00

- FLOOR(number)

Returns the largest integer less than, or equal to, the specified numeric expression.
Syntax:
FLOOR(expression)
Example:
SELECT FLOOR($223.45), CEILING($-223.45), CEILING($0.0)
Output:
223.00      -224.00        0.00

- MOD(number, divisor)

Returns the remainder of the division from 2 integer values.
Syntax:
MOD(dividend, divisor)
Example:
SELECT MOD(20,3)
Output:
2

- POWER(number, power)

Returns the exponential value for the numeric expression.
Syntax:
POWER(number, power)
Example:
SELECT POWER(2.0, 3.0)
Output:
8.0

- SIGN(number)

Returns the sign i.e. positive or negative value for the numeric expression. It returns -1 for negative expressions, a value of 0 for zero
Syntax:
SIGN(number)
Example:
SELECT SIGN(4)
Output:
1

- ROUND(number, precision)

Returns the numeric value rounded off to the next value specified.
Syntax:
ROUND(number, number of places)
Example:
SELECT ROUND(1.3456, 2)

- SQRT(number)

Returns the square root value of the expression.
Syntax:
SQRT(number)
Example:
SELECT SQRT(4.0)
Output:
2.0

- TRUNC(number, precision)

Returns a numeric value that truncate to the specific places
Syntax:
TRUNCATE(number,places)
Example:
SELECT TRUNCATE(1.3456, 2)
Output:
1.34

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1724
Q:

What are the varoius components of physical database structure of Oracle database?

Answer

Oracle database comprises of three kinds of files:
- Datafiles
- Redo log files
- Control files

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1719
Q:

How can we read and write operating system files from PL/SQL program?

Answer

The UTL_FILE database package can be used to read and write operating system files. You need to have read /write access rights in that directory before the package can be used.


Example to write file:


Fhandler is a variable of type UTL_FILE.FILE_TYPE


UTL_FILE.PUTF(fHandler, 'Im writing to a file\n');


 


Example to read file:


UTL_FILE.GET_LINE(fHandler, buf);

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

0 1717
Q:

What are Cursors? Explain Types of cursors in PL/SQL

Answer

Cursors help you manipulate the information retrieved by select statements. This can be done by assigning a name to the cursor.


Example:


CURSOR emp_cur 


IS 


SELECT emp_number from employee_tbl where employee_name = name_in;


Types of Cursors:


Implicit cursors- These cursors are not declared by the programmer. They are issued when the SQL statement is executed. The open, close and fetching is done by itself.


Example:


UPDATE employee SET salary = salary * 2.1;


Here, an implicit cursor is issued to identify the set of rows in the table which would be affected by the update.


 


Explicit cursors- These cursors are defined by programmer. They are used in queries that return multiple rows.


Example:


CURSOR emp_cur 


IS 


SELECT emp_number from employee_tbl where employee_name = name_in;

Report Error

View answer Workspace Report Error Discuss

Subject: Oracle

1 1700