<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Technical Interview Questions &#187; Oracle Interview Questions &amp; Answers - 2</title>
	<atom:link href="http://www.technicalinterview.info/category/oracle-interview-questions-answers-2/feed" rel="self" type="application/rss+xml" />
	<link>http://www.technicalinterview.info</link>
	<description>Java Interview Questions &#124; IT interview questions &#124; Software Testing Interview questions &#124; .Net Interview Questions &#124; Job Interview Questions &#38; Answers &#124; Tough Interview Questions &#124; Technology Interview Questions &#124; Tech Interview Questions &#124; Testing Interview Questions &#124; SAP Interview Questions &#124; ABAP Interview Questions &#124; Data Warehousing Interview Questions</description>
	<pubDate>Tue, 02 Sep 2008 08:33:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Oracle Interview Questions &#038; Answers - 2</title>
		<link>http://www.technicalinterview.info/oracle-interview-questions-answers-2/</link>
		<comments>http://www.technicalinterview.info/oracle-interview-questions-answers-2/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 13:37:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Oracle Interview Questions &amp; Answers - 2]]></category>

		<guid isPermaLink="false">http://www.technicalinterview.info/oracle-interview-questions-answers-2/</guid>
		<description><![CDATA[A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check
You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that balls to the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>A user is getting an ORA-00942 error yet you know you have granted them permission on the table, what else should you check</strong></p>
<p>You need to check that the user has specified the full name of the object (select empid from scott.emp; instead of select empid from emp;) or has a synonym that balls to the object (create synonym emp for scott.emp;)</p>
<p><strong>A developer is trying to create a view and the database won?t let him. He has the &#8220;DEVELOPER&#8221; role which has the &#8220;CREATE VIEW&#8221; system privilege and SELECT grants on the tables he is using, what is the problem</strong></p>
<p>You need to verify the developer has direct grants on all tables used in the view. You can?t create a stored object with grants given through views.</p>
<p><strong>If you have an example table, what is the best way to get sizing data for the production table implementation</strong></p>
<p>The best way is to analyze the table and then use the data provided in the DBA_TABLES view to get the average row length and other pertinent data for the calculation. The quick and dirty way is to look at the number of blocks the table is actually using and ratio the number of rows in the table to its number of blocks against the number of expected rows.</p>
<p><strong>How can you find out how many users are currently logged into the database? How can you find their operating system id</strong></p>
<p>There are several ways. One is to look at the v$session or v$process views. Another way is to check the current_logins parameter in the v$sysstat view. Another if you are on UNIX is to do a &#8220;ps -ef|grep oracle|wc -l? command, but this only works against a single instance installation.</p>
<p><strong>A user selects from a sequence and gets back two values, his select is: SELECT pk_seq.nextval FROM dual;What is the problem</strong></p>
<p>Somehow two values have been inserted into the dual table. This table is a single row, single column table that should only have one value in it.</p>
<p><strong>How can you determine if an index needs to be dropped and rebuilt</strong></p>
<p>Run the ANALYZE INDEX command on the index to validate its structure and then calculate the ratio of LF_BLK_LEN/LF_BLK_LEN+BR_BLK_LEN and if it isn?t near 1.0 (i.e. greater than 0.7 or so) then the index should be rebuilt. Or if the ratio BR_BLK_LEN/ LF_BLK_LEN+BR_BLK_LEN is nearing 0.3.</p>
<p><strong>How can variables be passed to a SQL routine</strong></p>
<p>By use of the &#038; symbol. For passing in variables the numbers 1-8 can be used (&#038;1, &#038;2,&#8230;,&#038;8) to pass the values after the command into the SQLPLUS session. To be prompted for a specific variable, place the ampersanded variable in the code itself: &#8220;select * from dba_tables where owner=&#038;owner_name;&#8221; . Use of double ampersands tells SQLPLUS to resubstitute the value for each subsequent use of the variable, a single ampersand will cause a reprompt for the value unless an ACCEPT statement is used to get the value from the user.</p>
<p><strong>You want to include a carriage return/linefeed in your output from a SQL script, how can you do this</strong></p>
<p>The best method is to use the CHR() function (CHR(10) is a return/linefeed) and the concatenation function &#8220;||&#8221;. Another method, although it is hard to document and isn?t always portable is to use the return/linefeed as a part of a quoted string.</p>
<p><strong>How can you call a PL/SQL procedure from SQL</strong></p>
<p>By use of the EXECUTE (short form EXEC) command.</p>
<p><strong>How do you execute a host operating system command from within SQL</strong></p>
<p>By use of the exclamation ball &#8220;!&#8221; (in UNIX and some other OS) or the HOST (HO) command.</p>
<p><strong>You want to use SQL to build SQL, what is this called and give an example</strong></p>
<p>This is called dynamic SQL. An example would be:<br />
set lines 90 pages 0 termout off feedback off verify off<br />
spool drop_all.sql<br />
select ?drop user ?||username||? cascade;? from dba_users<br />
where username not in (&#8221;SYS?,?SYSTEM?);<br />
spool off<br />
Essentially you are looking to see that they know to include a command (in this case DROP USER&#8230;CASCADE;) and that you need to concatenate using the ?||? the values selected from the database.</p>
<p><strong>What SQLPlus command is used to format output from a select</strong></p>
<p>This is best done with the COLUMN command.</p>
<p><strong>You want to group the following set of select returns, what can you group on</strong></p>
<p>Max(sum_of_cost), min(sum_of_cost), count(item_no), item_no The only column that can be grouped on is the &#8220;item_no&#8221; column, the rest have aggregate functions associated with them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.technicalinterview.info/oracle-interview-questions-answers-2/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
