What are % TYPE and % ROWTYPE ? What are the advantages of using these over datatypes?

1 Answer

Answer :

% TYPE provides the data type of a variable or a database column to
that variable.
% ROWTYPE provides the record type that represents a entire row of a
table or view or columns selected in the cursor.
The advantages are :
I. Need not know about variable's data type
ii. If the database definition of a column in a table changes, the data
type of a variable changes accordingly.

Related questions

Description : What is difference between % ROWTYPE and TYPE RECORD ?

Last Answer : % ROWTYPE is to be used whenever query returns a entire row of a table or view. TYPE rec RECORD is to be used whenever query returns columns of different table or views and variables. E.g. ... emp ename %type ); e_rec emp% ROWTYPE cursor c1 is select empno,deptno from emp; e_rec c1 %ROWTYPE.

Description : What are the datatypes a available in PL/SQL ?

Last Answer : Some scalar data types such as NUMBER, VARCHAR2, DATE, CHAR, LONG, BOOLEAN. Some composite data types such as RECORD & TABLE.

Description : what are the datatypes supported By oracle (INTERNAL)?

Last Answer : Varchar2, Number,Char , MLSLABEL.

Description : There is a % sign in one field of a column. What will be the query to find it?

Last Answer : '' Should be used before '%'.

Description : What are the default values of the primitive datatypes int and float?

Last Answer : Ans. The default value of int is 0 and the default value of float is 0.0f.

Description : what are the datatypes supported By oracle (INTERNAL)

Last Answer : Varchar2, Number,Char , MLSLABEL.

Description : What are stored-procedures? And what are the advantages of using them.

Last Answer : Stored procedures are database objects that perform a user defined operation. A stored procedure can have a set of compound SQL statements. A stored procedure executes the SQL commands and returns the result to the client. Stored procedures are used to reduce network traffic.

Description : What are the advantages of operating a database in ARCHIVELOG mode over operating it in NO ARCHIVELOG mode ?

Last Answer : Complete database recovery from disk failure is possible only in ARCHIVELOG mode. Online database backup is possible only in ARCHIVELOG mode.

Description : It is possible to use raw devices as data files and what is the advantages over file. system files ?

Last Answer : Yes. The advantages over file system files. I/O will be improved because Oracle is bye-passing the kernnel which writing into disk. Disk Corruption will be very less.

Description : What are the advantages of VIEW ?

Last Answer : To protect some of the columns of a table from other users.To hide complexity of a query.To hide complexity of calculations.

Description : What are the advantages of having a Package ?

Last Answer : Increased functionality (for example,global package variables can be declared and used by any proecdure in the package) and performance (for example all objects of the package are parsed compiled, and loaded into memory once)

Description : What are advantages fo Stored Procedures?

Last Answer : Extensibility,Modularity, Reusability, Maintainability and one time compilation.

Description : What is a package ? What are the advantages of packages ? What is Pragma EXECPTION_INIT ? Explain the usage ?

Last Answer : The PRAGMA EXECPTION_INIT tells the complier to associate an exception with an oracle error. To get an error message of a specific oracle error. e.g. PRAGMA EXCEPTION_INIT (exception name, oracle error number)

Description : What are the advantages of views?

Last Answer : Provide an additional level of table security, by restricting access to a predetermined set of rows and columns of a table. - Hide data complexity. - Simplify commands for the user. - Present the data in a different perspective from that of the base table. - Store complex queries.

Description : Advantages of DBMS?

Last Answer : ∙ Redundancy is controlled. ∙ Unauthorized access is restricted. ∙ Providing multiple user interfaces. ∙ Enforcing integrity constraints. ∙ Providing backup and recovery.

Description : How does one backup a database using the export utility? (for DBA

Last Answer : Oracle exports are "logical" database backups (not physical) as they extract data and logical definitions from the database into a file. Other backup strategies normally back-up the physical data ... exports include more information about the database in the export file than user level exports.

Description : Give the reasoning behind using an index.

Last Answer : Faster access to data blocks in a table.

Description : How you will avoid your query from using indexes?

Last Answer : SELECT * FROM emp Where emp_no+' '=12345; i.e you have to concatenate the column name with space within codes in the where condition. SELECT /*+ FULL(a) */ ename, emp_no from emp where emp_no=1234; i.e using HINTS

Description : What is the maximum buffer size that can be specified using the DBMS_OUTPUT.ENABLE function?

Last Answer : 1,000,00

Description : Why is Oracle not using the damn index? (for DBA

Last Answer : This problem normally only arises when the query plan is being generated by the Cost Based Optimizer. The usual cause is because the CBO calculates that executing a Full Table Scan would be faster ... with AUTOTRACE to see the statistics. Compare this to the explain plan when not using an index.

Description : How does one backup a database using RMAN? (for DBA

Last Answer : The biggest advantage of RMAN is that it only backup used space in the database. Rman doesn't put tablespaces in backup mode, saving on redo generation overhead. RMAN will re-read database ... directly to tape. Alternatively one can backup to disk and then manually copy the backups to tape.

Description : How will you enforce security using stored procedures?

Last Answer : Don't grant user access directly to tables within the application. Instead grant the ability to access the procedures that access the tables. When procedure executed it will execute the privilege of procedures owner. Users cannot access tables except via the procedure.

Description : How can one see who is using a temporary segment? (for DBA

Last Answer : For every user using temporary space, there is an entry in SYS.V$_LOCK with type 'TS'. All temporary segments are named 'ffff.bbbb' where 'ffff' is the file it is in and 'bbbb' is ... For usage stats, see SYS.V_$SORT_SEGMENT From Oracle 8.0, one can just query SYS.v$sort_usage. Look at these

Description : How will you enforce security using stored procedures?

Last Answer : Don't grant user access directly to tables within the application. Instead grant the ability to access the procedures that access the tables. When procedure executed it will execute the privilege of procedures owner. Users cannot access tables except via the procedure.

Description : What is Enterprise Structure Configurator (ESC) and what are the benefits of using it?

Last Answer : The ESC is an interview-based tool that guides you through the configuration of your enterprise structures. Use the ESC as part of your set up to define the organization structures and job and position structures of the enterprise.

Description : How can I dump an oracle schema to a LOCAL file over a network connection from sqlplus?

Last Answer : By connecting and spooling are you excluding the exp/imp commands (or expdb/impdb in 10g)?

Description : The value recorded in system.last_record variable is of type

Last Answer : a. Number b. Boolean c. Character. ? b. Boolean.

Description : What type of index should you use on a fact table?

Last Answer : A Bitmap index.

Description : Give the two types of tables involved in producing a star schema and the type of data they hold.

Last Answer : Fact tables and dimension tables. A fact table contains measurements while dimension tables will contain data that will help describe the fact tables.

Description : What is difference between CHAR and VARCHAR2 ? What is the maximum SIZE allowed for each type ?

Last Answer : CHAR pads blank spaces to the maximum length. VARCHAR2 does not pad blank spaces. For CHAR it is 255 and 2000 for VARCHAR2.

Description : What should be the return type for a cursor variable.Can we use a scalar data type as return type?

Last Answer : The return type for a cursor must be a record type.It can be declared explicitly as a user-defined or %ROWTYPE can be used. eg TYPE t_studentsref IS REF CURSOR RETURN students%ROWTYPE

Description : Explain the two type of Cursors ?

Last Answer : There are two types of cursors, Implicit Cursor and Explicit Cursor. PL/SQL uses Implicit Cursors for queries. User defined cursors are called Explicit Cursors. They can be declared and used.

Description : What are the different type of a record group?

Last Answer : Query record group Static record group Non query record group

Description : What are the type of User Exits ?

Last Answer : ORACLE Precompliers user exits OCI (ORACLE Call Interface) Non-ORACEL user exits. Page :

Description : When do you use data parameter type?

Last Answer : When the value of a data parameter being passed to a called product is always the name of the record group defined in the current form. Data parameters are used to pass data to produts invoked with the run_product built-in subprogra

Description : What are the various type of snapshots?

Last Answer : Simple and Complex.

Description : What are the different type of Segments ?

Last Answer : Data Segment, Index Segment, Rollback Segment and Temporary Segment.

Description : What are the type of Synonyms?

Last Answer : There are two types of Synonyms Private and Public.

Description : What are the different absence type patterns available in Fusion Absence Management?

Last Answer : An absence pattern contains a predefined set of rules that you can use as a starting point to create an absence type. The pattern that you select determines whether special fields ... patterns available in Fusion Absence Management. ∙Illness or injury ∙Childbirth or placement ∙Generic absence

Description : What is degree of Relationship type?

Last Answer : It is the number of entity type participating.

Description : What is Relationship type?

Last Answer : Relationship type defines a set of associations or a relationship set among a given set of entity types.

Description : What is an Extension of entity type?

Last Answer : The collections of entities of a particular entity type are grouped together into an entity set.

Description : What is an Entity type?

Last Answer : It is a collection (set) of entities that have same attributes.

Description : A Column is having many repeated values which type of index you should create on this column, if you have to?

Last Answer : For example, assume there is a motor vehicle database with numerous low-cardinality columns such as car_color, car_make, car_model, and car_year. Each column contains less than 100 distinct values by themselves, and a b tree index would be fairly useless in a database of 20 million vehicles.

Description : What type of indexes are available in Oracle?

Last Answer : There are many index types within Oracle: B*Tree Indexes - common indexes in Oracle. They are similar construct to a binary tree; they provide fast access by key, to an individual row or range of ... They allow data to be sorted from big to small (descending) instead of small to big (ascending).

Description : SQL> SELECT * FROM MY_SCHEMA.MY_TABLE; SP2-0678: Column or attribute type cannot be displayed by SQL*Plus Why I’m getting this error?

Last Answer : The table has a BLOB column.

Description : What does "jumps off the screen" mean?

Last Answer : answer:AMD is a relatively small manufacturer but well established in the industry. In this context, AMD jumps off the screen at the guy doing the research into acquiring companies for ... chip manufacturing division, but AMD is the one that really stands out from an acquisition perspective.

Description : How to add conditions in select statement in oracle?

Last Answer : Just add the decode

Description : What are the two ways to incorporate images into a oracle forms application?

Last Answer : Boilerplate Images Image_items

Description : Can one export a subset of a table? (for DBA

Last Answer : From Oracle8i one can use the QUERY= export parameter to selectively unload a subset of the data from a table. Look at this example: exp scott/tiger tables=emp query=\"where deptno=10\"