 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: oracle 10g query</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/</link>
	<description></description>
	<lastBuildDate>Sun, 19 May 2013 03:14:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: helloworldwecome</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-116772</link>
		<dc:creator>helloworldwecome</dc:creator>
		<pubDate>Wed, 27 Feb 2013 06:05:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-116772</guid>
		<description><![CDATA[I have an array of coordinates. For this I have created a type &quot;create or replace type coo as varchar(1000) of number(10)&quot; . all I want to is to read each and every value of this&lt;br&gt;]]></description>
		<content:encoded><![CDATA[<p>I have an array of coordinates. For this I have created a type &#8220;create or replace type coo as varchar(1000) of number(10)&#8221; . all I want to is to read each and every value of this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67460</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Thu, 27 Aug 2009 14:24:55 +0000</pubDate>
		<guid isPermaLink="false">#comment-67460</guid>
		<description><![CDATA[The first code will work in Oracle if:

You have a table named INCOME, with the following columns (at least):
-income_amount
-date

And you have a table named EXPENSE, with the following columns (at least):
-paid
-date

If you are going to run your query from SQL*Plus, you should prefix the parameters with &#039;&amp;&#039;

&lt;pre&gt;where date between &amp;var_Start_date and &amp;var_end_date&lt;/pre&gt;

If you are going to put the query in a Developer report, I think you have to prefix them with &#039;:&#039;

In Sql Server, I think you will have to write a stored procedure if you want to use the dates as parameters.

You could, however, &lt;b&gt;try&lt;/b&gt; your queries with specific dates.


As for you second query, it would be more efficient writing a stored procedure or function, similar to the one suggested in the original answer, but with SQLServer syntax.]]></description>
		<content:encoded><![CDATA[<p>The first code will work in Oracle if:</p>
<p>You have a table named INCOME, with the following columns (at least):<br />
-income_amount<br />
-date</p>
<p>And you have a table named EXPENSE, with the following columns (at least):<br />
-paid<br />
-date</p>
<p>If you are going to run your query from SQL*Plus, you should prefix the parameters with &#8216;&amp;&#8217;</p>
<pre>where date between &amp;var_Start_date and &amp;var_end_date</pre>
<p>If you are going to put the query in a Developer report, I think you have to prefix them with &#8216;:&#8217;</p>
<p>In Sql Server, I think you will have to write a stored procedure if you want to use the dates as parameters.</p>
<p>You could, however, <b>try</b> your queries with specific dates.</p>
<p>As for you second query, it would be more efficient writing a stored procedure or function, similar to the one suggested in the original answer, but with SQLServer syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zaman31502</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67435</link>
		<dc:creator>zaman31502</dc:creator>
		<pubDate>Thu, 27 Aug 2009 04:43:04 +0000</pubDate>
		<guid isPermaLink="false">#comment-67435</guid>
		<description><![CDATA[dear sir i try the code u send me it also give a number of errors about my column names. it gives me error like this &lt;b&gt;unknown column name income, unknown column name paid etc &lt;/b&gt;all the column i use in my query it treat them as error. dear sir can the following code works fine in the oracle 10g with out any errors or it also show me the errors.
&lt;b&gt;select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss
from
(select sum(income_amount) income, 0 expense, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 income, sum(paid) expense, 0 profit_loss
from expense
where date between var_Start_date and var_end_date)&lt;/b&gt;
how the parameters &lt;b&gt;var_Start_date and var_end_date&lt;/b&gt; works. Is when i run the report these parameters will prompt to get start date and end date separately for income table and expense table or they will prompt oncely for both income and expense subqueries? if sir this query prompt for both subqueries separately  then how can it possible to prompt once for start date and end date for both subqueries. plz sir tell me this. 

sir i try the following code in sql server 2000 to get data from two tables it works but i cannot succeed to get profit from this plz sir also tell me how can i use parameters with this code . the code is :

&lt;b&gt;select distinct income_amount = (select sum(income_amount) from income ), paid=(select sum(paid)from expense )
from income, expense &lt;/b&gt;
plz sir check this code and plz make any ammendments in it how to calculate profit with it. thank you sir for responding me. because ur suggestions are very helpfull for me.plz sir also tell me about the first code will it work with oracle 10g without errors and also about its parameters how they will work. i m waiting for ur reply.]]></description>
		<content:encoded><![CDATA[<p>dear sir i try the code u send me it also give a number of errors about my column names. it gives me error like this <b>unknown column name income, unknown column name paid etc </b>all the column i use in my query it treat them as error. dear sir can the following code works fine in the oracle 10g with out any errors or it also show me the errors.<br />
<b>select sum(income) total_income, sum(expense) total_expense, (sum(income) &#8211; sum(expense)) total_profit_loss<br />
from<br />
(select sum(income_amount) income, 0 expense, 0 profit_loss<br />
from income<br />
where date between var_start_date and var_end_date<br />
union<br />
select 0 income, sum(paid) expense, 0 profit_loss<br />
from expense<br />
where date between var_Start_date and var_end_date)</b><br />
how the parameters <b>var_Start_date and var_end_date</b> works. Is when i run the report these parameters will prompt to get start date and end date separately for income table and expense table or they will prompt oncely for both income and expense subqueries? if sir this query prompt for both subqueries separately  then how can it possible to prompt once for start date and end date for both subqueries. plz sir tell me this. </p>
<p>sir i try the following code in sql server 2000 to get data from two tables it works but i cannot succeed to get profit from this plz sir also tell me how can i use parameters with this code . the code is :</p>
<p><b>select distinct income_amount = (select sum(income_amount) from income ), paid=(select sum(paid)from expense )<br />
from income, expense </b><br />
plz sir check this code and plz make any ammendments in it how to calculate profit with it. thank you sir for responding me. because ur suggestions are very helpfull for me.plz sir also tell me about the first code will it work with oracle 10g without errors and also about its parameters how they will work. i m waiting for ur reply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zaman31502</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67433</link>
		<dc:creator>zaman31502</dc:creator>
		<pubDate>Thu, 27 Aug 2009 04:23:10 +0000</pubDate>
		<guid isPermaLink="false">#comment-67433</guid>
		<description><![CDATA[dear sir i try the code u send me it also give a number of errors about my column names. it gives me error like this &lt;b&gt;unknown column name income, unknown column name paid etc&lt;/b&gt; all the column  i use in my query it treat them as error. dear sir  can the following code works fine in the oracle 10g with out any errors or it also show me the errors.
&lt;b&gt;select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss
from
(select sum(income_amount) income, 0 expense, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 income, sum(paid) expense, 0 profit_loss
from expense
where date between var_Start_date and var_end_date)&lt;/b&gt;

 how the parameters &lt;b&gt; var_Start_date and var_end_date&lt;/b&gt; works, Is when i run the report these parameters will come to get value separately for income table and expense table or they will get value oncely. plz sir tell me this. sir i try the following code in sql server 2000 to get data from two tables it works but i cannot succeed to get profit from this plz sir also tell me how can i use parameters with this code . the code is :

 &lt;b&gt;select distinct  income_amount = (select sum(income_amount) from income ), paid=(select sum(paid)from expense )
 from income, expense &lt;/b&gt;
plz sir check this code and  plz make amy ammendments in it how to calculate profit with it. thank you sir for responding me. because ur suggestions are very helpfull for me.plz sir also tell me about the first code will it work with oracle 10g without errors and also about its parameters how they will work. i m waiting for ur reply.]]></description>
		<content:encoded><![CDATA[<p>dear sir i try the code u send me it also give a number of errors about my column names. it gives me error like this <b>unknown column name income, unknown column name paid etc</b> all the column  i use in my query it treat them as error. dear sir  can the following code works fine in the oracle 10g with out any errors or it also show me the errors.<br />
<b>select sum(income) total_income, sum(expense) total_expense, (sum(income) &#8211; sum(expense)) total_profit_loss<br />
from<br />
(select sum(income_amount) income, 0 expense, 0 profit_loss<br />
from income<br />
where date between var_start_date and var_end_date<br />
union<br />
select 0 income, sum(paid) expense, 0 profit_loss<br />
from expense<br />
where date between var_Start_date and var_end_date)</b></p>
<p> how the parameters <b> var_Start_date and var_end_date</b> works, Is when i run the report these parameters will come to get value separately for income table and expense table or they will get value oncely. plz sir tell me this. sir i try the following code in sql server 2000 to get data from two tables it works but i cannot succeed to get profit from this plz sir also tell me how can i use parameters with this code . the code is :</p>
<p> <b>select distinct  income_amount = (select sum(income_amount) from income ), paid=(select sum(paid)from expense )<br />
 from income, expense </b><br />
plz sir check this code and  plz make amy ammendments in it how to calculate profit with it. thank you sir for responding me. because ur suggestions are very helpfull for me.plz sir also tell me about the first code will it work with oracle 10g without errors and also about its parameters how they will work. i m waiting for ur reply.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67374</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 26 Aug 2009 13:27:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-67374</guid>
		<description><![CDATA[In SQL server you will probably need to assign an alias for the view.  Something like this:

&lt;pre&gt;select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss
from
(select sum(income_amount) income, 0 expense, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 income, sum(paid) expense, 0 profit_loss
from expense
where date between var_Start_date and var_end_date) &lt;b&gt;AS income_expense&lt;/b&gt;&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>In SQL server you will probably need to assign an alias for the view.  Something like this:</p>
<pre>select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss
from
(select sum(income_amount) income, 0 expense, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 income, sum(paid) expense, 0 profit_loss
from expense
where date between var_Start_date and var_end_date) <b>AS income_expense</b></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: zaman31502</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67355</link>
		<dc:creator>zaman31502</dc:creator>
		<pubDate>Wed, 26 Aug 2009 04:37:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-67355</guid>
		<description><![CDATA[hi dear i check this query 

&lt;b&gt;select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss
from
(select sum(income_amount) income, 0 expense, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 income, sum(paid) expense, 0 profit_loss
from expense
where date between var_Start_date and var_end_date)&lt;/b&gt;
in the SQL server 2000 . it give me the following error 

&lt;b&gt;Server: Msg 170, Level 15, State 1, Line 10
Line 10: Incorrect syntax near &#039;)&#039;.&lt;/b&gt;

plz dear tell me how can i resolve this error. actually i did not apply this code in the oracl 10g yet. but i make a practice of SQL by using SQL server 2000 with the help  of material u give me.  plz sir check this query and correct my syntax error which i mention above.]]></description>
		<content:encoded><![CDATA[<p>hi dear i check this query </p>
<p><b>select sum(income) total_income, sum(expense) total_expense, (sum(income) &#8211; sum(expense)) total_profit_loss<br />
from<br />
(select sum(income_amount) income, 0 expense, 0 profit_loss<br />
from income<br />
where date between var_start_date and var_end_date<br />
union<br />
select 0 income, sum(paid) expense, 0 profit_loss<br />
from expense<br />
where date between var_Start_date and var_end_date)</b><br />
in the SQL server 2000 . it give me the following error </p>
<p><b>Server: Msg 170, Level 15, State 1, Line 10<br />
Line 10: Incorrect syntax near &#8216;)&#8217;.</b></p>
<p>plz dear tell me how can i resolve this error. actually i did not apply this code in the oracl 10g yet. but i make a practice of SQL by using SQL server 2000 with the help  of material u give me.  plz sir check this query and correct my syntax error which i mention above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67112</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Wed, 19 Aug 2009 04:29:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-67112</guid>
		<description><![CDATA[In this case, the query is not getting data directly from tables, but from another SELECT (which works like a temporary table or view), and income and expense are columns from that view.

&lt;pre&gt;(select sum(income_amount) &lt;b&gt;&lt;i&gt;income&lt;/i&gt;&lt;/b&gt;, 0 &lt;b&gt;&lt;i&gt;expense&lt;/i&gt;&lt;/b&gt;, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 &lt;b&gt;&lt;i&gt;income&lt;/i&gt;&lt;/b&gt;, sum(paid) &lt;b&gt;&lt;i&gt;expense&lt;/i&gt;&lt;/b&gt;, 0 profit_loss
from expense
where date between var_Start_date and var_end_date)&lt;/pre&gt;

The UNION operator is used to combine the results of two or more queries into a single result.

I would recommend you read some SQL tutorial like &lt;a href=&quot;http://www.sql-tutorial.com/&quot;&gt;this&lt;/a&gt; to get some basic knowledge of the SQL language.

Regards,]]></description>
		<content:encoded><![CDATA[<p>In this case, the query is not getting data directly from tables, but from another SELECT (which works like a temporary table or view), and income and expense are columns from that view.</p>
<pre>(select sum(income_amount) <b><i>income</i></b>, 0 <b><i>expense</i></b>, 0 profit_loss
from income
where date between var_start_date and var_end_date
union
select 0 <b><i>income</i></b>, sum(paid) <b><i>expense</i></b>, 0 profit_loss
from expense
where date between var_Start_date and var_end_date)</pre>
<p>The UNION operator is used to combine the results of two or more queries into a single result.</p>
<p>I would recommend you read some SQL tutorial like <a href="http://www.sql-tutorial.com/">this</a> to get some basic knowledge of the SQL language.</p>
<p>Regards,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zaman31502</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67111</link>
		<dc:creator>zaman31502</dc:creator>
		<pubDate>Wed, 19 Aug 2009 02:54:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-67111</guid>
		<description><![CDATA[thanks to both of u. if u dont mind if i face further problem than i will again ask a question.
&quot;select sum(income) total_income, sum(expense) total_expense, (sum(income) - sum(expense)) total_profit_loss&quot;
in this select statement, &quot;sum(income)&quot; this income is table name or an attribute from the table likewise &quot;sum(expense)&quot; this word expense is table name or a column from the expense table. what is the function of union? is this union unite the two queries? plz sir explain it in little detail.]]></description>
		<content:encoded><![CDATA[<p>thanks to both of u. if u dont mind if i face further problem than i will again ask a question.<br />
&#8220;select sum(income) total_income, sum(expense) total_expense, (sum(income) &#8211; sum(expense)) total_profit_loss&#8221;<br />
in this select statement, &#8220;sum(income)&#8221; this income is table name or an attribute from the table likewise &#8220;sum(expense)&#8221; this word expense is table name or a column from the expense table. what is the function of union? is this union unite the two queries? plz sir explain it in little detail.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: carlosdl</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67071</link>
		<dc:creator>carlosdl</dc:creator>
		<pubDate>Tue, 18 Aug 2009 14:13:30 +0000</pubDate>
		<guid isPermaLink="false">#comment-67071</guid>
		<description><![CDATA[Darryn is using 0 because his sub-queries return 3 columns (income, expense and profit_loss), but the first one gets data from INCOME only, and the second one gets data from EXPENSE only, so the first sub-query will provide the sum of INCOME and has to return 0 for expense so that it does not affect the result of the SUM(expense) in the main query.  The same applies for the second sub-query.  It is returning the sum of EXPENSE, and it has to return 0 for income so that it does not affect the result of the SUM(income) in the main query.

As for the profit_loss &lt;b&gt;in the sub-queries&lt;/b&gt;, I don&#039;t think it is necessary.

Hope this helps.]]></description>
		<content:encoded><![CDATA[<p>Darryn is using 0 because his sub-queries return 3 columns (income, expense and profit_loss), but the first one gets data from INCOME only, and the second one gets data from EXPENSE only, so the first sub-query will provide the sum of INCOME and has to return 0 for expense so that it does not affect the result of the SUM(expense) in the main query.  The same applies for the second sub-query.  It is returning the sum of EXPENSE, and it has to return 0 for income so that it does not affect the result of the SUM(income) in the main query.</p>
<p>As for the profit_loss <b>in the sub-queries</b>, I don&#8217;t think it is necessary.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: zaman31502</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/oracle-10g-query-3/#comment-67057</link>
		<dc:creator>zaman31502</dc:creator>
		<pubDate>Tue, 18 Aug 2009 06:15:35 +0000</pubDate>
		<guid isPermaLink="false">#comment-67057</guid>
		<description><![CDATA[thank u dear sir for sending me such a strong query, dear sir if u dont mind plz explaing this query . i dont understand the use of  &quot;0&quot; in the query . plz explain me why u use (0 expense, 0 profit_loss etc) in the query . what is the function of this &quot;0&quot; and union. plz explain this little bit.]]></description>
		<content:encoded><![CDATA[<p>thank u dear sir for sending me such a strong query, dear sir if u dont mind plz explaing this query . i dont understand the use of  &#8220;0&#8243; in the query . plz explain me why u use (0 expense, 0 profit_loss etc) in the query . what is the function of this &#8220;0&#8243; and union. plz explain this little bit.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.013 seconds using memcached
Object Caching 394/397 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-20 01:20:06 -->