Spool

SHIVANAND BHARTI <[email protected]> Mon, 22 Jul 2013 17:31:00 +0000
Newsgroups gmane.comp.db.oracle.toad.free
Message-ID <B75962E88A72F3438A4EC07F37C0375B0D882A@NCEXDAG02.familydollar.com>
--_000_B75962E88A72F3438A4EC07F37C0375B0D882ANCEXDAG02familydo_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi folks ... I have a query with bind variable which accepts date.
How can I run thais query for 30 different dates and get it's output in a f=
ile.

I can write the same query 30 times with different date and run it as ascri=
pt.
Or write a PL/SQL block.

But it is an one time thing and I am looking for something quick .
Is there an option in Toad by which I can spool out the output of a query f=
or different input for the same bind variable ?

For example how can I run this query for 30 different dates and spool  it's=
 output.

SELECT  :RunDate   ,
      ( SELECT COUNT(*)
           FROM store
          WHERE pstore_open_date =3D:RunDate  ) store_count
      ,( SELECT COUNT(*)
           FROM wh
          WHERE wh_open_date =3D:RunDate  ) ) wh_count
  FROM dual;


Thanks,
Shiva



---------------------------------------------------------------------------=
----------

NOTE: This e-mail message contains PRIVILEGED and CONFIDENTIAL information =
and is intended only for the use of
the specific individual or individuals to which it is addressed. If you are=
 not an intended recipient of this
e-mail, you are hereby notified that any unauthorized use, dissemination or=
 copying of this e-mail or the
information contained herein or attached hereto is strictly prohibited. If =
you receive this e-mail in error,
notify the person named above by reply e-mail and please delete it. Thank y=
ou.


--_000_B75962E88A72F3438A4EC07F37C0375B0D882ANCEXDAG02familydo_
Content-Type: text/html; charset=US-ASCII
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title 
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none; 
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">





<div class="WordSection1">
<p class="MsoNormal">Hi folks &#8230; I have a query with bind variable which accepts date.<o:p></o:p></p>
<p class="MsoNormal">How can I run thais query for 30 different dates and get it&#8217;s output in a file.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">I can write the same query 30 times with different date and run it as ascript.<o:p></o:p></p>
<p class="MsoNormal">Or write a PL/SQL block.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">But it is an one time thing and I am looking for something quick .<o:p></o:p></p>
<p class="MsoNormal">Is there an option in Toad by which I can spool out the output of a query for different input for the same bind variable ?<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">For example how can I run this query for 30 different dates and spool &nbsp;it&#8217;s output.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><span style="color:#1F497D">SELECT&nbsp; :RunDate&nbsp;&nbsp; ,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( SELECT COUNT(*) <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM store <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE pstore_open_date =:RunDate&nbsp;&nbsp;) store_count&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;,( SELECT COUNT(*) <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FROM wh <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WHERE wh_open_date =:RunDate&nbsp;&nbsp;) ) wh_count<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">&nbsp;&nbsp;FROM dual;<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Shiva<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<br clear=all> -------------------------------------------------------------------------------------
<p>
NOTE: This e-mail message contains PRIVILEGED and CONFIDENTIAL information and is intended only for the use of
the specific individual or individuals to which it is addressed. If you are not an intended recipient of this
e-mail, you are hereby notified that any unauthorized use, dissemination or copying of this e-mail or the
information contained herein or attached hereto is strictly prohibited. If you receive this e-mail in error,
notify the person named above by reply e-mail and please delete it. Thank you.





<!-- |**|begin egp html banner|**| -->

<br>

    
    
<br>

<!-- |**|end egp html banner|**| -->


<div width="1" style="color: white; clear: both;"/>__._,_.___</div>

<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src="http://geo.yahoo.com/serv?s=97476590/grpId=1103546/grpspId=1705115368/msgId=58539/stime=1374514271" width="1" height="1"> <br>

<!-- |**|end egp html banner|**| -->

    
<!-- |**|begin egp html banner|**| -->

<br>
      <div style="font-family: verdana; font-size: 77%; border-top: 1px solid #666; padding: 5px 0;" >
      Your email settings: Individual Email|Traditional <br>
      <a href="http://groups.yahoo.com/group/toad/join;_ylc=X3oDMTJmazB2Y2VuBF9TAzk3NDc2NTkwBGdycElkAzExMDM1NDYEZ3Jwc3BJZAMxNzA1MTE1MzY4BHNlYwNmdHIEc2xrA3N0bmdzBHN0aW1lAzEzNzQ1MTQyNzE-">Change settings via the Web</a> (Yahoo! ID required) <br>
      Change settings via email: <a href="mailto:[email protected]?subject=Email Delivery: Digest">Switch delivery to Daily Digest</a> | <a href = "mailto:[email protected]?subject=Change Delivery Format: Fully Featured">Switch to Fully Featured</a> <br>
           <a href="http://groups.yahoo.com/group/toad;_ylc=X3oDMTJkOXYxa2M1BF9TAzk3NDc2NTkwBGdycElkAzExMDM1NDYEZ3Jwc3BJZAMxNzA1MTE1MzY4BHNlYwNmdHIEc2xrA2hwZgRzdGltZQMxMzc0NTE0Mjcx">
        Visit Your Group 
      </a> |
      <a href="http://docs.yahoo.com/info/terms/">
        Yahoo! Groups Terms of Use
      </a> |
      <a href="mailto:[email protected]?subject=Unsubscribe">
       Unsubscribe 
      </a> 
 <br>
    </div>
  <br>

<!-- |**|end egp html banner|**| -->


<div style="color: white; clear: both;"/>__,_._,___</div>
</body>
</html>


--_000_B75962E88A72F3438A4EC07F37C0375B0D882ANCEXDAG02familydo_--