1) Update salary column in emp table to zero initially salary column has NULL data.
How you will do this in PL/SQL.
2) Types of Indexes.
3) What do you mean by snapshot.
Ans) A snapshot is a table that contains the
results of a query of one or more tables or views, often located on
a remote database.
In Oracle 9i instead of snapshot we can use meterialized views which can act as snapshot.
Diff between view & snapshot is view is not a table its a virtual table to join one or more table or to prevent access from users on complete data on table. whenever we will access the view that brings the data from tables only not from view(it wont store any kind of data).
but the snapshot itself store the query result data. usually we will use to get remote data to replicate the changes made at remote site.
4) How to read & write from a file.
5) Cursors.
6) Partitioning.
7) Empno mgrno
440 0
333 222
111 777
888 666
Having rows like this in emp table. Write a query for the below output
888 666
444 0
333 222
111 777
8) empid ename
1 ram
2 ram
3 ravi
4 ram
5 sagar
6 sam
7 sagar
Write a query to get ename whose count should be greater than 3.
9)empno ename depid
1 ram 2
2 sagar 2
3 ramya 2
4 shobha 1
Depid dname
1 admin
2 library
3 PMO
Write a query to fetch a dname where depid should not be in emp table
10) Integrity constraints
11) PL/SQL table
12)Global temporary table.
13)when we have a PL/SQL table Y we need global temporary table.
14)I have deleted the rows from the table & did commit, but I want to get back the history of rows.
15)Same record 2 users are updating will it update.
16)I want to declare a global variable for the entire session where you will declare.
17) I want to create a table through PL/SQL
Ans) Hi.....yes we can create a table by using a procedure or a function but it must be done by Dynamic SQL. Dynamic SQL is a programming technique that enables you to build SQL statements dynamically at runtime. lets say you want to create an EMP table at run time in a procedure. The table name must be like EMP_<location_name>. So to get this we can pass the location name at run time to the procedure. To create table in a procedure u can use the following syntax:
EXECUTE IMMEDIATE
'CREATE TABLE ' || 'EMP_' || loc ||
'(
empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(9),
sal NUMBER(7,2),
deptno NUMBER(2)
)';
You can also drop the table using Execute immediate. for example:
EXECUTE IMMEDIATE 'DROP TABLE ' || 'EMP_' || loc;
This way you use DDL commands in a procedure or function.
18) Disable all triggers for a particular table
Ans) alter trigger <trigger-name> disable
alter table<tablename> disable trigger<triggername>
19)what do you mean by database triggers. Y we cannot use in database triggers.
20)Difference b/w procedure & function
Ans) A FUNCTION is always returns a value using the return statement.
A PROCEDURE may return one or more values through parameters or may not return at all.
1. Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter.
Â
2. Function can be called from SQL statements where as procedure can not be called from the sql statements
3. Functions are normally used for computations where as procedures are normally used for executing business logic.
4. You can have DML (insert,update, delete) statements in a function. But, you cannot call such a function in a SQL query.
5. Function returns 1 value only. Procedure can return multiple values (max 1024).
6.Stored Procedure: supports deferred name resolution. Example while writing a stored procedure that uses table named tabl1 and tabl2 etc..but actually not exists in database is allowed only in during creation but runtime throws error Function wont support deferred name resolution.
7.Stored procedure returns always integer value by default zero. where as function return type could be scalar or table or table values
8. Stored procedure is precompiled execution plan where as functions are not.
Â
9.A procedure may modify an object where a function can only return a value The RETURN statement immediately completes the execution of a subprogram and returns control to the caller.
Functions can be called inside select stmt but not the procedures.
A Function can be used in the Sql Queries while a procedure can not be used in sql queries .that cause a major difference b/w function and procedures .
A function always return a values while procedure can return one or more values through Parameters.
A function can call directly by sql statement like select "func_name" from dual while procedure cannot.
Dml statement cannot be used in function,but it used in procedure.
A function returns a value where as a proceedure does not return a value
procedure can call in another project but function work in same project .
We can't have any DDL,DML and TLC command inside a function, if that function is called from a query.But if the function is not called from query then we can have all transactional statement(DDL,DML and TLC ) inside a function.
function can return a single values at maximum, where as in case if procedure returns one or more than one value and might not return a even a single value........
21)Can we call a function through SQL query any restriction is there? If I want to call the function having DML statements how we can achieve this.
22) When executing a query query got strucked . How you will find out where actually it got strucked.
23) what are pseudocolumns.
Ans) psedocolumns are the columns which can not be manipulated.
psedocoluns are only retrive. Examples are rowid,nextval etc
A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select from
pseudocolumns, but you cannot insert, update, or delete
their values.
psoducolumn in the sence which is not created by the user explicitly but user can use those things explicityly.
examples
rowid,rowno,currval,nextval,sysdate,uid,level.
RowID: While storing in the database oracle generates one id for each row.
you can call based upon the rowid .ex: select * from emp where rowid=....
RowNo : This no is also generated by oracle itself. but you cant call based upon this one in select clause
ROWID - Hexa decimal number each and every row having unique.Used in searching
ROWNUM - It is a integer number also unique for sorting Normally TOP N Analysys.
Other Psudo Column are
NEXTVAL,CURRVAL Of sequence are some exampls
Rowid is permanent for the life time whereas rownum is not. What i mean is till the time the record is present in the table, the value of ROWID of a particular row in a table will always be same whereas the value of ROWNUM will vary.
Even ROWID is also not permanent for life time.Because If one exports and imports the table data then ROWID changes.
Rowid is a unique identifier, when a row is inserted into the table it generates a row id and will be removed when the row is deleted.
For each row returned by the query a Rownum, pseudocolumn is returned in which order oracle selects the rows from the table. Using rownum one can even limit the number of rows selected from the table.
Ex: select * from emp where rownum<10;
Row id: Hexadecimal string representing the unique address of a row in its table. This datatype is primarily for values returned by the ROWID pseudocolumn.
Rownum: For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on. You can use ROWNUM to limit the number of rows returned by a query, as in this example:
SELECT * FROM employees WHERE ROWNUM < 10;
A pseudocolumn behaves like a table column, but is not actually stored in the table. You can select from pseudocolumns, but you cannot insert, update, or delete their values. This section describes these pseudocolumns:
- CURRVAL and NEXTVAL
- LEVEL
- ROWID
- ROWNUM
24)How to get all indexes which have been created on a table.
Ans) select index_name from user_indexes
where table_name = 'GNMCOMPANY';
Hi,
I'm preparing for an interview. I found these from some of the topic questions. The last time I used Oracle Forms/Reports was more than 2 years ago. My computer does not have a Personal Oracle so I can at least see the Help file, nor do I have yet the books to refer to.
It will be very helpful in my preparation if you can provide the answers for any the following questions.
1. How to use single data block to query multiple tables
2. How to see the select statement when we issue execute_query
3. How do you trap default forms processing ( DML)
4. What is purpose and order of firing the following triggers
- on fetch
- on select
5. What is the number of records buffered and Query array size properties of data block
6. What is the difference between object libraries and object groups
7. What is the difference between PL/SQL library and object library
8. What is the difference between pre-text-item and when-new-item-instance triggers
9. What is the order of firing the following triggers
- when-new-form-instance
- pre-text-item
(Both are in form-level)
10. What is the default validation unit of form module
11. What is the order of checking for a program unit from form module(local program unit, library, stored procedure)
13. what is the use of pre text/pre record/pre form
14. what is id_null function
15. what is the difference between call_form , open_form, new_form
- Which is restricted built-in and why?
- Which can't issue savepoint
16. which are the triggers will fire in the following situation:
I have three text items
1. Text-item1
1.key-next-item
Go_item (:text_item2);
Go_item (:text_item3);
2. Text-item2
1. Pre-text-item
2. When-validate-item
3. When-new-item-instance
4. Key-next-item
5. Post-text-item
6. Post-change
3. Text-item3
1. Pre-text-item
2. When-validate-item
3. When-new-item-instance
4. Key-next-item
5. Post-text-item
6. Post-change
If I press tab or enter key at text-item1 what are the triggers will fire and order of firing during the entire navigation.
If I change key-next-item trigger of text-item1
Go_item (:text_item2);
: Text_item2: ='Nagendra';
Go_item (:text_item3);
Then what are the triggers will fire and order of firing
17. How do you suppress the logon screen while running the form for the first time
18. What is primary canvas property of window and where it will be useful
19. I have when-button-pressed trigger at form , block and item level
If I want to execute first block, form then item level trigger what changes I have to make.
20. what is data parameter and text parameter
21. Can we re-generate a library that is currently accessing by some other session
22. Can we re-generate and save a library that has been attached with some forms but they are running currently.
23. Can we re-generate a library that has been attached with some forms , will the changes will reflect in the referenced forms
24. What is the use of transactional triggers
25. Can we modify a sub classed object ( from object group and from object libraries)
26. How to set forms default directory
27. What is the return data type of populate_group built-in
28. What is the difference between OLE object created at design time and runtime
29. Will the timer will expire during large query executing
30. What is the built-in package available to manipulate text files( forms)
31. Can we define a relation between two control blocks
32. If we change relation property from non-isolated to cascading what changes will occur
33. If we delete on-clear-details trigger in a relation what happens
34. What is the first trigger fires when we run a form
35. What is the use of enforce primary key property of data block
36. Can we put items other than buttons in the toolbars
37. Which object relates content and stacked canvases(window)
38. How to navigate from one form to other form(built-in)
39. How to copy values from list item to record group
40. In a non-isolated relation what is the order of firing the following triggers
1. on-populate-details
2. on-clear-details
3. pre-query
4. pre-select
41. How to find out the previous form id in multi form application(it's system variable)
42. How to use single LOV for multiple items
Multiple choice:
1. What is the size of Varchar in Oracle 8.0 ?
a. 2000
b. 4000
c. 254
d. none of the above
2. What is the size of Varchar in Oracle 7.0 ?
a. 2000
b. 4000
c. 254
d. none of the above
3. The default value the lpad function takes is
a. a space (' ')
b. an asterisk
c. The default value is not optional
d. None of the above
4. The no. of columns that may be used as composite primary key in oracle 8
a. 8
b. 16
c. 32
d. none of the above
5. which of the following is true about add_months
a. we can pass a numerical value in first parameter
b. we can pass a negative value in second parameter
c. Both a & b
d. None of the above
6. The latest date that can be stored in oracle 8
a. 31st Dec 4012 A.D
b. 31st Dec 4011 A.D
c. Dec 31st ,9999
d. None of the above.
7. What happens when the first date is greater than the second date that is passed to the months_between function in oracle 8.
a. It gives an error
b. It gives a negative value
c. None of the above
8. Regarding the Summary query which of the following is true
a. The order of the base column list in the select statement should be same in the Group by clause.
b. The order of the base column list in the select statement need not be same in the Group by clause.
c. None of the above
9. Regarding the Summary query which of the following is true
a. All the base table columns selected in the select list should be specified in the Group by clause.
b. All the base table columns selected in the select list need not be specified in the Group by clause.
c. None of the above.
10. How do u mask the user from entering irrelevant data ?
a. Synonym
b. View
c. Index
d. sequence
11. What does the length function returns when applied to column of char datatype ?
16. If you want to restrict the user, to enter the same values that has been stored in other table then what constraint do u use?
a. Entity integrity
b. Referential Integrity
c. Both a & b
d. None of the above
17. Which of the following is true about NULL?
a. when an arithmetic operation is performed on NULL, u will get the result as NULL
b. NULL is same as 0.
c. NULL is same as blank date.
d. None of the above
18. For a DDL statement, which of the following is true
a. A DDL statement is preceded and followed by commit.
b. All the DML statements gets committed even when u get an error after writing DDL statement.
c. Both a & b
d. None of the above.
19. Which of the following is true for update clause?
a. We can update two base tables simultaneously
b. U can use a subquery in SET clause of the UPDATE statement.
c. Both a & b
d. None of the above
20. Which of the following is true for delete?
a. Delete statement can be given without writing where clause.
b. We can delete two tables simultaneously
c. Both a & b
d. None of the above
22. In oracle 7 which of the following is true about manipulating the view
a. View based on two base tables can be manipulated
b. View having a column which contain operation can be manipulated
c. Both a & b
d. None of the above
23. In oracle 8 which of the following is true about manipulating the view
a. View based on two base tables can be manipulated
b. View having a column which contain operation can be manipulated
c. Both a & b
d. None of the above
24. Which of the following is true about packages
a. We can write a procedure in package body which has not been specified in package specification.
b. We cannot write a procedure in package body which has not been specified in package specification.
c. Both a & b
d. None of the above.
25. Which of the following is true about outer joins
a. The outer join symbol should be present on any one side of the join.
b. The outer join symbol may be present on both the sides of the join
c. The outer join return the rows from the two tables that donot have matching records in other table.
d. None of the above
27. What does OFA stands for ?
a. Oracle Flexible Architecture
b. Oracle Financials Applications
c. Optimal Flexible Architecture
d. None of the above
thanks in advance...