Escolar Documentos
Profissional Documentos
Cultura Documentos
Mutating Table: A mutating table is a table that is currently being modified by an UPDATE DELETE or INSERT
statement or a table that might need to be updated by the effects of a declarative DELETE CASCADE referential
integrity action. A table is not considered mutating for STATEMENT triggers.
The triggered table itself is a mutating table as well as any table referencing it with the FOREIGN KEY constraint.
This restriction prevents a row trigger from seeing an inconsistent set of data.
The Oracle mutating trigger error occurs when a trigger references the table that owns the trigger.
The best way to avoid this error is use autonomous transaction in triggers so that the child
transaction will be independent of the parent transaction.
PL/SQL array is a collection through which we can iterate just the way we can through cursor. But in case
of Cursor the context switching is for every row fetched while for associative array the context switching
will be once (using bulk collect). It's the performance which is different.
retirement '15-Aug-2007'
YEARS
--------------------------------------
58.56
YEARS
--------------------------------------
1.44
If query is running slow on Production Database, what are the steps needed to be checked?
Indexes need to be checked. If Indexes are being used or not. Or if indexes are not present then need to create
index.
a. Earlier Query was hitting Remote Database, after using Materialized View, it is hitting local database only. This
helps to Improve Performance.
You can run the ANALYZE INDEX <index> VALIDATE STRUCTURE command on the affected indexes - each
invocation of this command creates a single row in the INDEX_STATS view. This row is overwritten by the next
ANALYZE INDEX command, so copy the contents of the view into a local table after each ANALYZE. The
'badness' of the index can then be judged by the ratio of 'DEL_LF_ROWS' to 'LF_ROWS'.
For example, you may decide that index should be rebuilt if more than 20% of its rows are deleted:
However, generally speaking, indexes should not be rebuilt because performance will be degraded for a
considerable time afterwards. The issue is that after rebuild, all blocks are full up to the percent free setting.
Subsequent DML will therefore cause many block splits, until the index stabilizes with an appropriate amount of
free space.
http://www.tutorialspoint.com/sql/sql-cartesian-joins.htm
The CARTESIAN JOIN or CROSS JOIN returns the Cartesian product of the sets of records from the two or more
joined tables. Thus, it equates to an inner join where the join-condition always evaluates to True or where the join-
condition is absent from the statement.
e.g. cd C:\Laxman\Daily_Work\2015\Feb-15\10Feb15\04.05.04.03_Hot_fix_05_Local_Copy\DB
http://javarevisited.blogspot.in/2012/12/top-10-oracle-interview-questions-and-answers-database-sql.html
Question 1: Oracle version 9.2.0.4.0 what does each number refers to?
Answer: This is one of the frequently asked Oracle Interview questions. I have seen this question every now and
then. By the way SYSDATE function is used in oracle to find current date and time of operating system on which
the database is running return type of function is DATE
Question 3: Write the syntax to find current date and time in format “YYYY-MM-DD”.
Question 4: How will you convert a date to char in Oracle give one example?
Answer :. to_char() function is used to convert date to character we can specify format also in which we want the
output.
or
Answer: BCP or bulk copy tool is one type of command line tool for unload data from database came into
existence after oracle 8. It is used to import or export data from tables and views but it will not copy structure of
data same. Main advantage is fast mechanism for copying data and we can take backup of important data
easily.
Answer: Oracle reports are used to make business enable to provide information of all level within or outside in
secure way. REP file and RDF file extensions are used by oracle report.
Answer: SAVE POINTS are used to divide a transaction into smaller parts. It enables rolling back part of a
transaction. Maximum of five save points are allowed. Whenever we encounter error we can rollback from the
point where we set our SAVEPOINT. This is useful for multistage transaction and conditional transaction where
commit and rollback depend on certain condition.
I don't know. I assume there must be some sort of limit: just check out the Oracle manuals.
You can create unlimited savepoints in your transaction. There is no fix limit. Do you
have any fix limitation on number of transactions? No. Just like this there is also no
limit to create savepoints between transactions.
Answer: Hash cluster is one of the techniques to store the table in a hash cluster to improve the performance
of data retrieval .We apply hash function on the table row’s cluster key value and store in the hash cluster. All
rows with the same hash key value are stores together on disk. Key value is same like key of index cluster, for
data retrieval Oracle applies the hash function to the row's cluster key value.
http://java67.blogspot.in/2012/10/difference-between-clustered-vs-nonclustered-index-sql-database.html
Indexes are very important concept, it makes your queries to run fast and if you compare a SELECT
query which uses an indexed column to one who doesn't, you will see big difference in performance.
There can be two kinds of indexes in relational database Clustered and Nonclustered
indexes.
Clustered index determines physical sorting order of rows in a table similar to entries on yellow
pages which are sorted on alphabetical order. Suppose you have a table Employee, which contains
emp_id as primary key then clustered index which is created on primary key will sort the
Employee table as per emp_id.Nonclustered index involves one extra step which point
to physical location of record.
1) Clustered Index physically sort all rows while Nonclustered Index doesn't.
2) In SQL one table can only have one Clustered Index but there is no such restriction
on NonClustered Index.
Translate does character by character substitution, where as replace can substitute a single character with a
word.
http://career.guru99.com/top-50-oracle-interview-questions-and-answers/
/top-50-oracle-interview-questions-and-answers/?format=pdfDownload PDF
Varchar can store upto 2000 bytes and varchar2 can store upto 4000 bytes. Varchar will occupy space for NULL
values and Varchar2 will not occupy any space. Both are differed with respect to space.
RAW datatype is used to store values in binary data format. The maximum size for a raw in a table in 32767 bytes.
The NVL function is used to replace NULL values with another or given value. Example is –
5. Whether any commands are used for Months calculation? If so, what are they?
In Oracle, months_between function is used to find number of months between the given dates. Example is –
Months_between(Date 1, Date 2)
Nested table is a data type in Oracle which is used to support columns containing multi valued attributes. It also
hold entire sub table.
COALESCE function is used to return the value which is set to be not null in the list. If all values in the list are null,
then the coalesce function will return NULL.
Coalesce(value1, value2,value3,…)
A BLOB data type is a varying length binary string which is used to store two gigabytes memory. Length should be
specified in Bytes for BLOB.
Data Manipulation Language (DML) is used to access and manipulate data in the existing objects. DML
statements are insert, select, update and delete and it won’t implicitly commit the current transaction.
Duplicate rows can be removed by using the keyword DISTINCT in the select statement.
Merge statement is used to select rows from one or more data source for updating and insertion into a table or a
view. It is used to combine multiple operations.
NULL value represents missing or unknown data. This is used as a place holder or represented it in as default
entry to indicate that there is no actual data present.
The USING clause is used to specify with the column to test for equality when two tables are joined.
Employee tables join with the Salary tables with the Employee ID.
The WITH CHECK option clause specifies check level to be done in DML statements. It is used to prevent changes
to a view that would produce results that are not included in the sub query.
Aggregate function is a function where values of multiple rows or records are joined together to get a single value
output. Common aggregate functions are –
Average
Count
Sum
A GROUP BY clause can be used in select statement where it will collect data across multiple records and group
the results by one or more columns.
20. What is a sub query and what are the different types of subqueries?
Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub
query is added in the where clause of the main query.
A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list
of the outer query.
This can be evaluated as if it were an independent query. Results of the sub query are submitted to the main
query or parent query.
Cross join is defined as the Cartesian product of records from the tables present in the join. Cross join will
produce result which combines each row from the first table with the each row from the second table.
A privilege is nothing but right to execute an SQL query or to access another user object. Privilege can be given as
system privilege or user privilege.
VArray is an oracle data type used to have columns containing multivalued attributes and it can hold bounded
array of values.
Rename is a permanent name given to a table or a column whereas Alias is a temporary name given to a table or
column. Rename is nothing but replacement of name and Alias is an alternate name of the table or column.
View is a logical table which is based on one or more tables or views. The tables upon which the view is based are
called Base Tables and it doesn’t contain data.
A cursor variable is associated with different statements which can hold different values at run time. A cursor
variable is a kind of reference type.
Each cursor in Oracle has set of attributes which enables an application program to test the state of the cursor.
The attributes can be used to check whether cursor is opened or closed, found or not found and also find row
count.
SET operators are used with two or more queries and those operators are Union, Union All, Intersect and Minus.
31. How can we delete duplicate rows in a table?
%FOUND
Returns NULL if cursor is open and fetch has not been executed
Returns TRUE if the fetch of cursor is executed successfully.
Returns False if no rows are returned.
%NOT FOUND
Returns NULL if cursor is open and fetch has not been executed
Returns False if fetch has been executed
Returns True if no row was returned
%ISOPEN
Returns the number of rows fetched. It has to be iterated through entire cursor to give exact real count.
33. Can we store pictures in the database and if so, how it can be done?
Yes, we can store pictures in the database by Long Raw Data type. This datatype is used to store binary data for
2 gigabytes of length. But the table can have only one Long Raw data type.
An integrity constraint is a declaration defined a business rule for a table column. Integrity constraints are used to
ensure accuracy and consistency of data in a database. There are types – Domain Integrity, Referential Integrity
and Domain Integrity.
An alert is a window which appears in the center of the screen overlaying a portion of the current display.
Hash Cluster is a technique used to store the table for faster retrieval. Apply hash value on the table to retrieve
the rows from the table.
37. What are the various constraints used in Oracle?
NOT NULL – It is to indicate that particular column cannot contain NULL values
CHECK – Validate that values in the given column to meet the specific criteria
SUBSTR returns specific portion of a string and INSTR provides character position in which a pattern is
found in a string.
SUBSTR returns string whereas INSTR returns numeric.
IN, OUT and INOUT are the modes of parameters that can be passed to a procedure.
41. What are the differences between LOV and List Item?
LOV is property whereas list items are considered as single item. List of items is set to be a collection of list of
items. A list item can have only one column, LOV can have one or more columns.
Privileges are the rights to execute SQL statements – means Right to connect and connect. Grants are given to
the object so that objects can be accessed accordingly. Grants can be provided by the owner or creator of an
object.
43. What is the difference between $ORACLE_BASE and $ORACLE_HOME?
Oracle base is the main or root directory of an oracle whereas ORACLE_HOME is located beneath base folder in
which all oracle products reside.
44. What is the fastest query method to fetch data from the table?
Row can be fetched from table by using ROWID. Using ROW ID is the fastest query method to fetch data from the
table.
45. What is the maximum number of triggers that can be applied to a single table?
This query will display row numbers and the field values from the given table.
Select * from (select * from employees order by rownum desc) where rownum<2;
The DUAL table is a one-column table present in oracle database. The table has a single VARCHAR2 (1) column
called DUMMY which has a value of ‘X’.
There are no differences between the join. Cartesian and Cross joins are same.
Cross join gives cartesian product of two tables – Rows from first table is multiplied with another table which
is called cartesian product.
50. How to display employee records who gets more salary than the average salary in the department?
Select * from employee where salary>(select avg(salary) from dept, employee where dept.deptno =
employee.deptno;
http://techpreparation.com/computer-interview-questions/oracle-interview-questions-
answers35.htm#.VtaljRHlrIU
Interview Questions
http://www.javatpoint.com/oracle-interview-questions
http://stackoverflow.com/questions/14722883/what-is-the-maximum-number-of-columns-allowed-in-a-table
What is the maximum number of columns allowed in an Oracle table, in the following versions?
For versions 8i, 9i, 10g, and 11g, the limit is 1,000 columns per table.
Prior to that, Oracle 7 had a 254 column limit.
For Oracle 11g:
1000 Columns per table
32 columns per index
We said...
No, you may have upto 1,000 columns in a table these days.
If you have more than 255 - they will be stored in multiple row pieces (like a
chained row - the first 255 point to the next 255 point to the next 255 and so on)
http://stackoverflow.com/questions/2520871/what-is-the-limit-on-number-of-columns-in-oracle-10g-
and-derby-databases
What is the limit on number of columns in Oracle 10G and Derby Databases
http://www.red-database-security.com/whitepaper/oracle_default_ports.html
Oracle Net Listener / Enterprise Oracle Application Server / Edit listener.ora and
1521
Manager Repository port Oracle Database restart listener
http://thesprawl.org/research/oracle-default-ports/
Port# Name Description
http://stackoverflow.com/questions/3452902/how-to-increase-the-size-of-a-table-in-oracle
3452902 i have a table "DEPT" , let me know how to increase the size of a table.
The TNSPING utility can be used to test an Oracle Service Name. To use it:
1.Open a Command Prompt (click Start, click Run, type cmd, and then click OK).
2. Type tnsping <service name> (for Oracle 7.3 or Oracle 8i and later) or tnsping80 <service
name> (for Oracle 8.0), and then press enter.
What is the sequence of steps in which the query gets executed? How is the query executed at the
back-end by the database engine?
http://searchoracle.techtarget.com/answer/SELECT-query-sequence-of-execution
FROM
WHERE
GROUP BY
HAVING
SELECT
ORDER BY
The first step is always the FROM clause. In your case, this is pretty straight-forward, because there's only
one table, and there aren't any complicated joins to worry about. In a query with joins, these are evaluated in
this first step. The joins are assembled to decide which rows to retrieve, with the ON clause conditions being
the criteria for deciding which rows to join from each table. The result of the FROM clause is an
intermediate result. You could think of this as a temporary table, consisting of combined rows which satisfy
all the join conditions. (In your case the temporary table isn't actually built, because the optimizer knows it
can just access your table directly without joining to any others.)
The next step is the WHERE clause. In your case, you don't have one, so the optimizer knows that it must
retrieve all the rows from the intermediate result. In a query with a WHERE clause, each row in the
intermediate result is evaluated according to the WHERE conditions, and either discarded or retained.
Next comes the GROUP BY. If there's a GROUP BY clause, the intermediate result is now partitioned into
groups, one group for every combination of values in the columns in the GROUP BY clause. In your case, all
the rows in each group have the same item. You can think of the partitioning as a sort, although a sort may not
actually be involved if the intermediate result is already in item sequence (which happens when the rows
retrieved by the FROM clause are accessed in item sequence via an index).
Now comes the HAVING clause. The HAVING clause operates once on each group, and all rows from
groups which do not satisfy the HAVING clause are eliminated. In your case, something very interesting
happens here. After having laboriously assembled (and possibly sorted) an entire intermediate result table, the
optimizer now throws away all rows in every group except the group where the item is 'Tent' (a word on this
later). In any case, after the HAVING clause has filtered the groups, a new intermediate result set is produced,
and in this new intermediate result, there is only one row per group. This single row per group is allowed to
have only the following types of columns:
aggregate functions operating on any other columns in the first intermediate result
Next comes the SELECT. From the rows of the new intermediate result produced by the GROUP BY and
HAVING clauses, the SELECT now assembles the columns it needs. In particular, none of the columns in the
original tables are available unless they are in the GROUP BY clause. In your case, you are selecting
min(price), which, since it is an aggregate function, is a valid column coming from the GROUP BY and
HAVING process.
Finally, the last step is the ORDER BY clause. In your case, there isn't one. In queries with both a GROUP
BY and ORDER BY clause, you can reference columns in the ORDER BY only if they are in the new
intermediate result produced by the grouping process, i.e. columns in the GROUP BY or aggregate functions
(or expressions based on these).
Remember the interesting result I mentioned earlier? What I'd like you to do is run through these steps again,
but this time, imagine that your HAVING condition (item='Tent') were written as a WHERE condition
instead, and see if that might make a difference to what happens as the query is executed.
http://www.bennadel.com/blog/70-sql-query-order-of-operations.htm
https://docs.oracle.com/cd/B28359_01/server.111/b28320/limits003.htm
Using parallel SQL with Oracle parallel hint to improve database performance
Enhance customers' Oracle database performance by using parallel SQL with an Oracle parallel hint,
enabling a SQL statement to be simultaneously processed by multiple threads or processes.
Parallel SQL enables a SQL statement to be processed by multiple threads or processes
simultaneously.
Today's widespread use of dual and quad core processors means that even the humblest of modern
computers running an Oracle database will contain more than one CPU. Although desktop and laptop
computers might have only a single disk device, database server systems typically have database files
spread— striped—across multiple, independent disk devices. Without parallel technology— when a
SQL statement is processed in serial—a session can make use of only one of these CPUs or disk
devices at a time. Consequently, serial execution of a SQL statement cannot make use of all the
processing power of the computer. Parallel execution enables a single session and SQL statement to
harness the power of multiple CPU and disk devices.
Parallel processing can improve the performance of suitable SQL statements to a degree that is often not
possible by any other method. Parallel processing is available in Oracle Enterprise Edition only.
SELECT *
FROM sh.customers
ORDER BY cust_first_name, cust_last_name, cust_year_of_birth
If executing without the parallel query option, a single process would be responsible for fetching all the
rows in the CUSTOMERS table. The same process would be responsible for sorting the rows to satisfy
the ORDER BY clause.
We can request that Oracle execute this statement in parallel by using the PARALLEL hint:
If parallel processing is available, the CUSTOMERS table will be scanned by two processes in parallel.
A further two processes will be employed to sort the resulting rows. A final process—the session that
issued the SQL in the first place—combines the rows and returns the result set. The process that requests
and coordinates the parallel processing stream is the Query coordinator.
Oracle supports parallel processing for a wide range of operations, including queries, DDL, and DML:
Parallel SQL
•Using parallel SQL to improve Oracle database performance
•Parallel processing: Using parallel SQL effectively
•Parallel execution: Determining SQL suitability, benefits
What is the Difference between Clustered and Non-Clustered Table?
https://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:4941517587762
You Asked
Is fetching row(s) using Primary key Index (in where clause) is better than Fetching row(s) using Unique
Index (in where clause)?
Is there any internal difference between those Unique Index and Primary Key Index?
and we said...
There is no such thing as a "primary key index".
A primary key is two things:
a. assures the values in a column(s) are unique
b. assures they are NOT NULL
A primary key under the covers will use either a UNIQUE or NON-UNIQUE index. If the
primary key is deferrable it'll use a non-unique index. If the column(s) are already
indexed with a non-unique index, the primary key constraint will rely on that index.
Otherwise a primary key will happen to create a unique index.
Hence, there is no real difference here. Under the covers there will be either a unique or non-unique
index.
By all means -- if something is a primary key CALL IT THAT. Don't use a unique index,
use the primary key constraint.
https://decipherinfosys.wordpress.com/2007/07/04/back-to-the-basics-difference-between-primary-key-and-
unique-index/
Both can be declared on one or more columns, both can be used to enforce foreign keys (if the unique
index is on not null column(s)), both can be declared as clustered/non clustered indexes (SQL Server
lingo), both can be used on computed columns as well (SQL Server).
1. Column(s) that make the Primary Key of a table cannot be NULL since by definition; the Primary Key
cannot be NULL since it helps uniquely identify the record in the table. The column(s) that make up the
unique index can be nullable.
2. There can be only one Primary Key defined on the table where as you can have many unique indexes
defined on the table (if needed).
3. Also, in the case of SQL Server, if you go with the default options then a Primary Key is created as a
clustered index while the unique index (constraint) is created as a non-clustered index. This is just the
default behavior though and can be changed at creation time, if needed.
So, if the unique index is defined on not null column(s), then it is essentially the same as the Primary Key
and can be treated as an alternate key meaning it can also serve the purpose of identifying a record
uniquely in the table.
Roy,
Its actualy not "such a huge data".You have still not crossed 1TB.There are many shops who are running
databases or more than 10TBs even.There wont be any problem with the performance if the deployment
of both the db and the application is done optimally.As for the question that whether Oracle can stand or
not with this volume,surely it can.
Aman....
http://stackoverflow.com/questions/1487886/database-design-question-how-to-handle-a-huge-amount-of-
data-in-oracle
I have over 1.500.000 data entries and it's going to increase gradually over time. This huge amount
of data would come from 150 regions.
Now should I create 150 tables to manage this increasing huge data? Will this be efficient? I need
fast operation. ASP.NET and Oracle will be used.
5 Also, 1.5 million data entries is not that much. – Jack Marchetti Sep 28 '09 at 16:12
1487927 If all the data is the same, don't split it in to different tables. Take a look at Oracle's
table partitions. One-hundred fifty partitions (or more) split out by region (or
more) is probably more in line with what you're going to be looking for.
Can we use commit or rollback command in the exception part of PL/SQL block?
Yes, we can use the TCL commands (commit/rollback) in the exception block of a stored procedure/function. The
code in this part of the program gets executed like those in the body without any restriction. You can include any
business functionality whenever a condition in main block (body of a proc/func) fails and requires a follow-thru
process to terminate the execution gracefully!
COMMIT;
RAISE;
END
Declare
myexception EXCEPTION;
Begin
RAISE myexception;
EXCEPTION
When myexception then
insert into table_name values (......);
COMMIT;
What are the conditions which decide whether to use a table or a view or a materialized view?
1. Security reasons we can use view.
2. If there is more transaction in a base table we better chose materialized view for performance.
3. Depend upon the situation where we need to refresh the data in specific time interval.
=====================
Table is the basic entity in any RDBMS, so for storing data you need table.
For view - if you have complex query from which you want to extract data again and again; moreover it is a
standard data which is required by many other users; also for REPORTS generation then create view . Avoid
inserting / updating / deleting through view unless it is essential. Keep view as read only (FOR SHOWING
REPORTS)
For materialized view - this view is mainly used in data warehousing. if you have two databases and you want a
view in both databases, remember in data warehousing we deal in GB or TB datasize. So create a summary table
in a database and make the replica (materialized view) in other database.
[1] if data is in bulk and you need same data in more than one database then create summary table at one
database and replica in other databases.
[1] It save data in database whether simple view's definition is saved in database
[2] Can create partition or index on materialize view to enhance the performance of view, but cannot on simple
view.
What is nologging?
http://www.dba-oracle.com/t_nologging_append.htm
The nologging option is a great way to speed-up inserts and index creation. It bypasses the writing of the
redo log, significantly improving performance. However, this approach is quite dangerous if you need to
roll-forward through this time period during a database recovery. In nologging mode you are running
without a safety net when you run nologging operations and you must:
Backup before and after - You must take a backup, both before and after all nologging
operations
Only nologging operations during the nologging window - Between the backups (the
nologging processing window), ONLY nologging operations should be run in the middle of this
"backup sandwich".
http://www.techonthenet.com/oracle/functions/cast.php
In Oracle/PLSQL, the cast function converts one datatype to another. Syntax :
TO FROM
char, number datetime raw rowid, nchar,
varchar2 / interval urowid nvarchar2
char, varchar2 X X X X X
number X X
datetime / interval X X
raw X X
rowid, urowid X X
nchar, nvarchar2 X X X X X
This would convert the date (ie: 22-Aug-2003) into a varchar2(30) value.
We can't have any DDL DML and TCL 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 TCL ) inside a function.
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. A 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
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.
What is Normalization?
http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/
Normalization is the process of efficiently organizing data in a database. There are two goals of the
normalization process:
Eliminating redundant data (for example, storing the same data in more than one table) and ensuring data
dependencies make sense (only storing related data in a table). Both of these are worthy goals as they
reduce the amount of space a database consumes and ensure that data is logically stored
Answer
1st normal form: first identify the repeating group of fields n group them into separate table
2nd normal form: it should be in 1st normal form and check all fields are dependent on primary
key
3nd normal form: it should be in 2nd normal form and Remove columns that are not dependent
upon the primary key.
What is the result when size of char and varchar2 datatypes is same and different?
declare
A char(10):='Laxman';
B varchar2(10):='Laxman';
begin
if A=B then
dbms_output.put_line('char and varchar are equal');
else
dbms_output.put_line('char and varchar are NOT equal');
end if;
end;
declare
A char(6):='Laxman';
B varchar2(6):='Laxman';
begin
if A=B then
dbms_output.put_line('char and varchar are equal');
else
dbms_output.put_line('char and varchar are NOT equal');
end if;
end;
Conclusion: When size of char and varchar2 datatypes is same then both the assigned values are equal.
When size of char and varchar2 are different then the assigned values are not equal.