<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1920678676299289558</atom:id><lastBuildDate>Fri, 04 Oct 2024 19:48:36 +0000</lastBuildDate><title>TechKnowledges</title><description></description><link>http://techknowledges.blogspot.com/</link><managingEditor>noreply@blogger.com (pompa)</managingEditor><generator>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-639685943005256023</guid><pubDate>Fri, 06 Nov 2009 04:15:00 +0000</pubDate><atom:updated>2009-11-05T20:55:18.653-08:00</atom:updated><title>PL/SQL split function</title><description>create or replace function utl_split(str_in in varchar2, delim_in in varchar2 default &#39;.&#39;)&lt;br /&gt; return SplitType as&lt;br /&gt;/* !!!!!!!!!!!!!!!!! Warnning Please Read it before Use or Compile !!!!!!!!!!!!!!!!!!!!!!&lt;br /&gt;Author by Pompa if first compile you must be create object type as below script&lt;br /&gt;before compilie this function&lt;br /&gt;==scrip==============================&lt;br /&gt;create or replace type SplitType as table of varchar2(500); / ==scrip==============================&lt;br /&gt;How to use You can use by 2 method&lt;br /&gt;1. SELECT * FROM TABLE (CAST (utl_split (&#39;10.01.03.04.234&#39;) AS SplitType))&lt;br /&gt;2. declare catch_tmp SplitType;&lt;br /&gt;    begin&lt;br /&gt;      catch_tmp := utl_split(&#39;12345678910&#39;,&#39;&#39;) ;&lt;br /&gt;      for i in 1 .. catch_tmp.count loop&lt;br /&gt;        dbms_output.put_line(catch_tmp(i));&lt;br /&gt;      end loop;&lt;br /&gt;     end; */&lt;br /&gt;  str_tmp long default str_in delim_in;&lt;br /&gt;  indx_tmp number;&lt;br /&gt;  return_tmp SplitType := SplitType();&lt;br /&gt;begin&lt;br /&gt;  loop indx_tmp := instr( str_tmp, delim_in );&lt;br /&gt;  exit when (nvl(indx_tmp,0) = 0);&lt;br /&gt;    return_tmp.extend;&lt;br /&gt;    return_tmp( return_tmp.count ) := ltrim(rtrim(substr(str_tmp,1,indx_tmp-1)));&lt;br /&gt;    str_tmp := substr( str_tmp, indx_tmp+length(delim_in) );&lt;br /&gt;  end loop;&lt;br /&gt;  return return_tmp;&lt;br /&gt;end utl_split;</description><link>http://techknowledges.blogspot.com/2009/11/plsql-split-function.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-3033199802988751968</guid><pubDate>Fri, 26 Oct 2007 16:58:00 +0000</pubDate><atom:updated>2007-10-26T09:58:34.195-07:00</atom:updated><title>Perl Monitor State SQL server On Window</title><description>&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;### Check Proccess Database ###################################&lt;br /&gt;$state_agent = `sc \\\\acer-31cca9d11c. query sqlserveragent find /C &quot;STOPPED&quot;`;&lt;br /&gt;$state_sql = `sc \\\\acer-31cca9d11c. query mssqlserver find /C &quot;STOPPED&quot;`;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;### Check if SQL ServerAgent or MSsqlserver down order start ###&lt;br /&gt;if (($state_agen == 1) ($state_sql == 1)) { &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;### Check state of SQL ServerAgent ############################&lt;br /&gt;if ($state_agent == 1) { ## Shutdown SQL ServerAgent##&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;br /&gt;system(&#39;net stop sqlserveragent&#39;);&lt;br /&gt;$stop_agent = `sc \\\\acer-31cca9d11c. query sqlserveragent find /C &quot;STOPPED&quot;`;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;## Check Result of Stop SQL SeverAgent ##&lt;br /&gt;if ($stop_agent == 1) { ## Stop Success ##&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$agentrun = &quot;Shutdown[STOPPED] SQL ServerAgent have Completed.\n&quot;;&lt;br /&gt;print $agentrun;&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}else{&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$agentrun = &quot;Shutdown[STOPPED] SQL ServerAgent have Failure.\n&quot;;&lt;br /&gt;print $agentrun;&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}else{&lt;br /&gt;&lt;br /&gt;$agentrun = &quot;SQL ServerAgent Not STOPPED.\n&quot;;&lt;br /&gt;print $agentrun;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;br /&gt;### End Check state of SQL ServerAgent ##########################&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;### Check State of MSsqlserver ################################&lt;br /&gt;if ($state_sql == 1) { ## Shutdown MSsqlserver ##&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;system(&#39;net stop mssqlserver&#39;);&lt;br /&gt;$stop_sql = `sc \\\\acer-31cca9d11c. query mssqlserver find /C &quot;STOPPED&quot;`;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;## Check Result of Stop MSSQL Sever ##&lt;br /&gt;if ($stop_sql == 1) { ## Stop Success ##&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$sqlrun = &quot;Shutdown[STOPPED] MSSQL Server have Completed.\n&quot;;&lt;br /&gt;print $sqlrun;&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}else{&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$sqlrun = &quot;Shutdown[STOPPED] MSSQL Server have Failure.\n&quot;;&lt;br /&gt;print $sqlrun;&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}else{&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$sqlrun = &quot;MSSQL Server Not STOPPED.\n&quot;;&lt;br /&gt;print $sqlrun&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;br /&gt;### Check State of MSsqlserver ################################&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;### Start MSsqlserver and SQL ServerAgent ########################&lt;br /&gt;print &quot;[--Start Service--]\n&quot;;&lt;br /&gt;if ($state_sql == 1) { ## Start MSSQL Server if MSSQL Server Shutdown## &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;system(&#39;net start mssqlserver&#39;);&lt;br /&gt;$start_sql = `sc \\\\acer-31cca9d11c. query mssqlserver find /C &quot;RUNNING&quot;`;&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;## Check Result of Start MSSQL Server ##########################&lt;br /&gt;if ($start_sql == 1) { ## Start Success ##&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$msgservice .= &quot;\t\tStart MSSQL Server have Completed.\n&quot;;&lt;br /&gt;$state_agent = 1;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}else{ &lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$state_agent = 0;&lt;br /&gt;$msgservice .= &quot;\t\tStart MSSQL Server have Failure.\n&quot;;&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;if ($state_agent == 1) { ## Start SQL ServerAgent if SQL Server Agent Down ##&lt;br /&gt;&lt;br /&gt;system(&#39;net start sqlserveragent&#39;);&lt;br /&gt;$start_agent = `sc \\\\acer-31cca9d11c. query sqlserveragent find /C &quot;RUNNING&quot;`;&lt;/span&gt;&lt;/p&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;## Check Result of Start SQL ServerAgent ########################&lt;br /&gt;if ($start_agent == 1) {## Start Success ##&lt;br /&gt;&lt;br /&gt;$msgservice .= &quot;\t\tStart SQL ServerAgent have Completed.\n&quot;;&lt;br /&gt;&lt;br /&gt;}else{&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;$msgservice .= &quot;\t\tStart SQL ServerAgent have Failure.\n&quot;;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;p align=&quot;left&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://techknowledges.blogspot.com/2007/10/perl-monitor-state-sql-server-on-window.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-612230759805822959</guid><pubDate>Fri, 26 Oct 2007 16:16:00 +0000</pubDate><atom:updated>2007-10-26T09:16:43.753-07:00</atom:updated><title>MsSQL T-SQL HTTP POST String</title><description>&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;declare @iobject int,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;@ihr int,&lt;br /&gt;@data nvarchar(4000) ,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Trebuchet MS;font-size:85%;&quot;&gt;@smtpWebService varchar(200), &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Trebuchet MS;font-size:85%;&quot;&gt;@retVal varchar(8000), &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Trebuchet MS;font-size:85%;&quot;&gt;@src varchar(1000), &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Trebuchet MS;font-size:85%;&quot;&gt;@desc varchar(1000)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Trebuchet MS;font-size:85%;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;exec @ihr = sp_oaCreate &#39;Msxml2.ServerXMLHTTP.3.0&#39;, @iobject OUTPUT &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;if (@ihr &lt;&gt; 0)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;begin &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;exec sp_displayoaerrorinfo @iobject, @ihr return&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;end&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;set @data = &#39;boo=yeah&#39; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;set @smtpWebService = &#39;http://www.google.com&#39;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;exec @ihr = sp_OAMethod @iobject, &#39;Open&#39;, null, &#39;POST&#39;,@smtpWebService, 0&lt;br /&gt;exec @ihr = sp_OAMethod @iobject, &#39;setRequestHeader&#39;, null, &#39;Content-Type&#39;, &#39;application/x-www-form-urlencoded&#39;&lt;br /&gt;exec @ihr = sp_OAMethod @iobject, &#39;send&#39;, null, @data &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;br /&gt;if @ihr &lt;&gt; 0&lt;br /&gt;begin&lt;br /&gt;exec sp_OAGetErrorInfo @iobject, @src OUT, @desc OUT&lt;br /&gt;select hr = convert(varbinary(4),@ihr), &lt;/span&gt;&lt;a href=&quot;mailto:Source=@src&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;Source = @src&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;, &lt;/span&gt;&lt;a href=&quot;mailto:Description=@desc&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;Description = @desc&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt; &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;--raiserror(&#39;Error Creating COM Component 0x%x, %s, %s&#39;,16,1, @ihr, @src, @desc) return &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;print @src &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;print @desc&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;&lt;br /&gt;exec @ihr = sp_OAGetProperty @iObject, &#39;responseText&#39;, @retVal OUT&lt;br /&gt;print @retVal&lt;br /&gt;-- Destroy the object&lt;br /&gt;exec @ihr = sp_OADestroy @iobject&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;</description><link>http://techknowledges.blogspot.com/2007/10/t-sql-http-post-string.html</link><author>noreply@blogger.com (pompa)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-8149637479550013454</guid><pubDate>Fri, 19 Oct 2007 17:16:00 +0000</pubDate><atom:updated>2007-10-19T10:16:47.802-07:00</atom:updated><title>Oracle job of type EXECUTABLE failed with exit code: Permission denied</title><description>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;&lt;span style=&quot;font-family: lucida grande;&quot;&gt;Created schedule job&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;br /&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;DBMS_SCHEDULER.create_job&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;(job_name =&gt; &#39;DF_Partitions&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;repeat_interval =&gt; &#39;FREQ=HOURLY;INTERVAL=2&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;job_type =&gt; &#39;EXECUTABLE&#39;,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;job_action =&gt; &#39;/home/osadmin/bin/df.sh&#39;, &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;enabled =&gt; TRUE,&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;comments =&gt; &#39;Check Partitions on System&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;);&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;set permission on file&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;#chown oracle:dba /home/osadmin/bin/df.sh&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;#chmod 750 /home/osadmin/bin/df.sh&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;But I found &quot;ORA-27369: job of type EXECUTABLE failed with exit code: Permission denied &quot; in schedule log. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;So, I resolve that i changed permission on $ORACLE_HOME/bin/extjob file.&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family: trebuchet ms;&quot;&gt;#chown oracle:dba $ORACLE_HOME/bin/extjob&lt;/span&gt;&lt;/span&gt;</description><link>http://techknowledges.blogspot.com/2007/10/oracle-job-of-type-executable-failed.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-2427190428312548598</guid><pubDate>Fri, 19 Oct 2007 16:57:00 +0000</pubDate><atom:updated>2007-10-19T09:57:56.470-07:00</atom:updated><title>Oracle pl/sql function urlencode, urldecode</title><description>&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;----------------------------------------------------------------------&lt;br /&gt;create or replace function &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;urlencode&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;----------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;(p_str in varchar2) return varchar2 is&lt;br /&gt;&lt;br /&gt;/* Declare */&lt;br /&gt;l_tmp varchar2(6000);&lt;br /&gt;l_hex varchar2(16) default ‘0123456789ABCDEF’;&lt;br /&gt;l_num number;&lt;br /&gt;l_bad varchar2(100) default ‘ &gt;%}\~];?@&amp;amp;&lt;#{|^[`/:=$+&#39;&#39;&quot;&#39;;&lt;br /&gt;l_char char(1);&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;if p_str is null&lt;br /&gt;then&lt;br /&gt;return null;&lt;br /&gt;end if;&lt;br /&gt;for i in 1 .. length(p_str) loop&lt;br /&gt;l_char := substr(p_str, i, 1);&lt;br /&gt;if instr(l_bad, l_char) &gt; 0&lt;br /&gt;then&lt;br /&gt;l_num := ascii(l_char);&lt;br /&gt;l_tmp := l_tmp || ‘%’ ||&lt;br /&gt;substr(l_hex, mod(trunc (l_num / 16), 16) + 1, 1) ||&lt;br /&gt;substr(l_hex, mod(l_num, 16) + 1, 1);&lt;br /&gt;else&lt;br /&gt;l_tmp := l_tmp || l_char;&lt;br /&gt;end if;&lt;br /&gt;end loop;&lt;br /&gt;return l_tmp;&lt;br /&gt;end urlencode;&lt;br /&gt;/&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;----------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; create or replace function &lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;urldecode&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;----------------------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;(p_str in varchar2) return varchar2 is&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;/* Declare */&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; l_hex varchar2(16) := ‘0123456789ABCDEF’;&lt;br /&gt;l_idx number := 0;&lt;br /&gt;l_ret long := p_str;&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;if p_str is null then&lt;br /&gt;return p_str;&lt;br /&gt;end if;&lt;br /&gt;loop&lt;br /&gt;l_idx := instr(l_ret, ‘%’, l_idx + 1);&lt;br /&gt;exit when l_idx = 0;&lt;br /&gt;l_ret := substr(l_ret, 1, l_idx - 1) ||&lt;br /&gt;chr((instr(l_hex, substr(l_ret, l_idx + 1, 1)) - 1) * 16 +&lt;br /&gt;instr(l_hex, substr(l_ret, l_idx + 2, 1)) - 1) ||&lt;br /&gt;substr(l_ret, l_idx + 3);&lt;br /&gt;end loop;&lt;br /&gt;return l_ret;&lt;br /&gt;end &lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;urldecode&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;;&lt;br /&gt;/&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Tahoma;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt; Test:&lt;br /&gt;SQL&gt; select urlencode(’&amp;amp;+=’) from dual;&lt;br /&gt;URLENCODE(’&amp;amp;+=’)&lt;br /&gt;——————————————————————————–&lt;br /&gt;%26%2B%3D&lt;br /&gt;SQL&gt; select &lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;urldecode&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;(’%26%2B%3D’) from dual;&lt;br /&gt;&lt;strong&gt;&lt;b&gt;&lt;span style=&quot;font-family:Tahoma;color:black;&quot;&gt;&lt;script&gt;&lt;!-- D([&quot;mb&quot;,&quot;\u003cspan style\u003d\&quot;font-family:Tahoma;color:black;background:#A0FFFF\&quot;\&gt;URLDECODE\u003c/span\&gt;\u003c/font\&gt;\u003c/b\&gt;\u003c/strong\&gt;(’%26%2B%3D’)\u003cbr\&gt;\n——————————————————————————–\u003cbr\&gt;\n&amp;amp;+\u003d\u003c/span\&gt;\u003c/font\&gt;\u003c/p\&gt;\n\n\u003cp\&gt;\u003cfont size\u003d\&quot;2\&quot; face\u003d\&quot;Tahoma\&quot;\&gt;\u003cspan style\u003d\&quot;font-size:10.0pt;font-family:Tahoma\&quot;\&gt; \u003c/span\&gt;\u003c/font\&gt;\u003c/p\&gt;\n\n\u003c/div\&gt;\n\n\u003c/div\&gt;\n\n\n&quot;,0] ); D([&quot;ce&quot;]);  //--&gt;&lt;/script&gt;&lt;span style=&quot;background: rgb(160, 255, 255) none repeat scroll 0% 50%; font-family: Tahoma; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;&quot;&gt;URLDECODE&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/strong&gt;(’%26%2B%3D’)&lt;br /&gt;——————————————————————————–&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;</description><link>http://techknowledges.blogspot.com/2007/10/oracle-plsql-function-urlencode.html</link><author>noreply@blogger.com (pompa)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-2871726194447439409</guid><pubDate>Fri, 19 Oct 2007 16:48:00 +0000</pubDate><atom:updated>2007-10-19T09:48:19.939-07:00</atom:updated><title>MySQL Flow Control Constructs</title><description>&lt;dl  style=&quot;font-weight: bold;font-family:lucida grande;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;1. &lt;code class=&quot;literal&quot;&gt;IF&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;IF &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;br /&gt; [ELSEIF &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;] ...&lt;br /&gt; [ELSE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;]&lt;br /&gt;END IF&lt;/span&gt;&lt;/pre&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;table face=&quot;trebuchet ms&quot; border=&quot;1&quot;&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;IF()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;If/else construct&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;IFNULL()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Null if/else construct&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;NULLIF()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return NULL if expr1 = expr2&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a name=&quot;function_if&quot;&gt;&lt;/a&gt;&lt;a class=&quot;indexterm&quot; name=&quot;id2947795&quot;&gt;&lt;/a&gt;&lt;code class=&quot;literal&quot;&gt;IF(&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr1&lt;/code&gt;&lt;/em&gt;,&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr2&lt;/code&gt;&lt;/em&gt;,&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr3&lt;/code&gt;&lt;/em&gt;)&lt;/code&gt;&lt;/span&gt; &lt;/p&gt; &lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;If &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr1&lt;/code&gt;&lt;/em&gt; is &lt;code class=&quot;literal&quot;&gt;TRUE&lt;/code&gt; (&lt;code class=&quot;literal&quot;&gt;&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr1&lt;/code&gt;&lt;/em&gt; &lt;&gt; 0&lt;/code&gt; and &lt;code class=&quot;literal&quot;&gt;&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr1&lt;/code&gt;&lt;/em&gt; &lt;&gt;  NULL&lt;/code&gt;) then &lt;code class=&quot;literal&quot;&gt;IF()&lt;/code&gt; returns &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr2&lt;/code&gt;&lt;/em&gt;; otherwise it returns &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr3&lt;/code&gt;&lt;/em&gt;. &lt;code class=&quot;literal&quot;&gt;IF()&lt;/code&gt;  returns a numeric or string value, depending on the context in which it is used.  &lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT IF(1&gt;2,2,3);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;     -&gt; 3&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT IF(1&lt;2,&#39;yes&#39;,&#39;no&#39;);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;     -&gt; &#39;yes&#39;&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT IF(STRCMP(&#39;test&#39;,&#39;test1&#39;),&#39;no&#39;,&#39;yes&#39;);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;     -&gt; &#39;no&#39;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;If only one of &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr2&lt;/code&gt;&lt;/em&gt; or &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr3&lt;/code&gt;&lt;/em&gt; is explicitly &lt;code class=&quot;literal&quot;&gt;NULL&lt;/code&gt;, the result type of the &lt;code class=&quot;literal&quot;&gt;IF()&lt;/code&gt; function is the type of the non-&lt;code class=&quot;literal&quot;&gt;NULL&lt;/code&gt; expression. &lt;/span&gt;&lt;/p&gt; &lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr1&lt;/code&gt;&lt;/em&gt; is evaluated as an integer  value, which means that if you are testing floating-point or string values, you  should do so using a comparison operation. &lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:85%;&quot; &gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT IF(0.1,1,0);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;        -&gt; 0&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT IF(0.1&lt;&gt;0,1,0);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;       -&gt; 1&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;In the first case shown, &lt;code class=&quot;literal&quot;&gt;IF(0.1)&lt;/code&gt; returns &lt;code class=&quot;literal&quot;&gt;0&lt;/code&gt; because &lt;code class=&quot;literal&quot;&gt;0.1&lt;/code&gt; is converted to an  integer value, resulting in a test of &lt;code class=&quot;literal&quot;&gt;IF(0)&lt;/code&gt;. This may  not be what you expect. In the second case, the comparison tests the original  floating-point value to see whether it is non-zero. The result of the comparison  is used as an integer. &lt;/span&gt;&lt;/p&gt; &lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;The default return type of &lt;code class=&quot;literal&quot;&gt;IF()&lt;/code&gt; (which may matter  when it is stored into a temporary table) is calculated as follows:&lt;/span&gt; &lt;/p&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;2. &lt;code class=&quot;literal&quot;&gt;CASE&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;CASE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;case_value&lt;/code&gt;&lt;/em&gt;&lt;br /&gt; WHEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;when_value&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;br /&gt; [WHEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;when_value&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;] ...&lt;br /&gt; [ELSE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;]&lt;br /&gt;END CASE&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Or: &lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;CASE&lt;br /&gt; WHEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;br /&gt; [WHEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; THEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;] ...&lt;br /&gt; [ELSE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;]&lt;br /&gt;END CASE&lt;/span&gt;&lt;/pre&gt;&lt;/dd&gt;&lt;dt  style=&quot;font-weight: normal;font-family:trebuchet ms;&quot;&gt; &lt;span style=&quot;font-size:85%;&quot;&gt;The &lt;code class=&quot;literal&quot;&gt;CASE&lt;/code&gt; statement for stored routines implements  a complex conditional construct. If a &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; evaluates to true, the  corresponding SQL statement list is executed. If no search condition matches,  the statement list in the &lt;code class=&quot;literal&quot;&gt;ELSE&lt;/code&gt; clause is executed.  Each &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt; consists of one or  more statements.&lt;/span&gt;&lt;/dt&gt;&lt;/dl&gt;&lt;div class=&quot;section&quot; lang=&quot;en&quot;&gt;&lt;p&gt; &lt;/p&gt; &lt;div class=&quot;note&quot; style=&quot;margin-left: 0.5in; margin-right: 0.5in;&quot;&gt; &lt;h3  style=&quot;font-style: italic;font-family:courier new;&quot; class=&quot;title&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;Note&lt;/span&gt;&lt;/h3&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;The syntax of the &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;CASE&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;emphasis&quot;  style=&quot;font-family:courier new;&quot;&gt;&lt;em&gt;statement&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; shown here for use inside stored  routines differs slightly from that of the SQL &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;CASE&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;emphasis&quot;  style=&quot;font-family:courier new;&quot;&gt;&lt;em&gt;expression&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; described in &lt;/span&gt;&lt;a style=&quot;font-family: courier new;&quot; title=&quot;11.3. Control Flow Functions&quot; href=&quot;http://www.blogger.com/control-flow-functions.html&quot;&gt;“Control Flow Functions”&lt;/a&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;.  The &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;CASE&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; statement cannot have an &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;ELSE NULL&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; clause, and it is terminated with &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;END CASE&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt; instead of &lt;/span&gt;&lt;code style=&quot;font-family: courier new;&quot; class=&quot;literal&quot;&gt;END&lt;/code&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;!--UdmComment--&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms; font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT CASE 1 WHEN 1 THEN &#39;one&#39;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;    -&gt;     &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms; font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;WHEN 2 THEN &#39;two&#39; ELSE &#39;more&#39; END;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;        -&gt; &#39;one&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms; font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT CASE WHEN 1&gt;0 THEN &#39;true&#39; ELSE &#39;false&#39; END;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;        -&gt; &#39;true&#39;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms; font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT CASE BINARY &#39;B&#39;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;    -&gt;     &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms; font-weight: bold;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;WHEN &#39;a&#39; THEN 1 WHEN &#39;b&#39; THEN 2 END;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;        -&gt; NULL&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;3. &lt;code class=&quot;literal&quot;&gt;LOOP&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-weight: normal;font-size:85%;&quot; &gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;[&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;:] LOOP&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;    &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;END LOOP [&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;    LOOP&lt;/code&gt; implements a simple loop construct, enabling  repeated execution of the statement list, which consists of one or more  statements. The statements within the loop are repeated until the loop is  exited; usually this is accomplished with a &lt;code class=&quot;literal&quot;&gt;LEAVE&lt;/code&gt;  statement.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;&lt;a href=&quot;http://www.blogger.com/leave-statement.html&quot;&gt;4. &lt;code class=&quot;literal&quot;&gt;LEAVE&lt;/code&gt; Statement&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;&lt;br /&gt;&lt;/dd&gt;&lt;dd  style=&quot;font-weight: normal;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;LEAVE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;label&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt style=&quot;font-weight: normal;&quot;&gt;     &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;This statement is used to exit any labeled flow control construct. It can be  used within &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;BEGIN ... END&lt;/code&gt; or loop constructs (&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;LOOP&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;, &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;, &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;WHILE&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;).&lt;/span&gt;&lt;/span&gt; &lt;/dt&gt;&lt;/dl&gt;&lt;!--UdmComment--&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;5. &lt;code class=&quot;literal&quot;&gt;ITERATE&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd  style=&quot;font-weight: normal;font-family:trebuchet ms;&quot;&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;ITERATE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;label&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;     &lt;/pre&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;ITERATE&lt;/code&gt; can appear only within &lt;code class=&quot;literal&quot;&gt;LOOP&lt;/code&gt;, &lt;code class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt;, and &lt;code class=&quot;literal&quot;&gt;WHILE&lt;/code&gt; statements. &lt;code class=&quot;literal&quot;&gt;ITERATE&lt;/code&gt; means  “&lt;span class=&quot;quote&quot;&gt;do the loop again.&lt;/span&gt;”&lt;/span&gt;&lt;/p&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;CREATE PROCEDURE doiterate(p1 INT)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;  label1: LOOP&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;    SET p1 = p1 + 1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;    IF p1 &lt;&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;    LEAVE label1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;  END LOOP label1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;  SET @x = p1;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;END&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;6. &lt;code class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd  style=&quot;font-weight: normal;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/dd&gt;&lt;dd style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;[&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;:] REPEAT     &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; UNTIL &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; END REPEAT [&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    The statement list within a &lt;code class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt; statement is  repeated until the &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; is  true. Thus, a &lt;code class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt; always enters the loop at least  once. &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt; consists of one or  more statements. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;    A &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;REPEAT&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; statement can be labeled. &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; cannot be given unless &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; also is present. If both are  present, they must be the same.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:85%;&quot; &gt;mysql&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;delimiter //&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;mysql&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;CREATE PROCEDURE dorepeat(p1 INT)&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt; -&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;BEGIN&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt; -&gt;   &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;SET @x = 0;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt; -&gt;   &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;REPEAT SET @x = @x + 1; UNTIL @x &gt; p1 END REPEAT;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt; -&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;END&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt; -&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;//&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;CALL dorepeat(1000)//&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&gt; &lt;strong class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT @x//&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;+------+&lt;br /&gt;| @x   |&lt;br /&gt;+------+&lt;br /&gt;| 1001 |&lt;br /&gt;+------+&lt;br /&gt;1 row in set (0.00 sec)&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&lt;dl face=&quot;lucida grande&quot; style=&quot;font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/flow-control-constructs.html&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span class=&quot;section&quot;&gt;7. &lt;code class=&quot;literal&quot;&gt;WHILE&lt;/code&gt; Statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/dt&gt;&lt;dd style=&quot;font-weight: normal;&quot;&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;[&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;:] WHILE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt; DO&lt;br /&gt; &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;END WHILE [&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;]&lt;/span&gt;&lt;/pre&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    The statement list within a &lt;code class=&quot;literal&quot;&gt;WHILE&lt;/code&gt; statement is  repeated as long as the &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;search_condition&lt;/code&gt;&lt;/em&gt;  is true. &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt; consists of one  or more statements. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;    A &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;WHILE&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; statement can be labeled. &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; cannot be given unless &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; also is present. If both are  present, they must be the same.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;EX&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:85%;&quot; &gt;CREATE PROCEDURE dowhile()&lt;br /&gt;BEGIN&lt;br /&gt;DECLARE v1 INT DEFAULT 5;&lt;br /&gt;&lt;br /&gt;WHILE v1 &gt; 0 DO&lt;br /&gt; ...&lt;br /&gt; SET v1 = v1 - 1;&lt;br /&gt;END WHILE;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:85%;&quot; &gt;END&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;dl style=&quot;font-family: lucida grande; font-weight: bold;&quot;&gt;&lt;dt&gt;&lt;br /&gt;&lt;/dt&gt;&lt;/dl&gt;</description><link>http://techknowledges.blogspot.com/2007/10/mysql-flow-control-constructs.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-7501407978093250097</guid><pubDate>Fri, 19 Oct 2007 16:45:00 +0000</pubDate><atom:updated>2007-10-19T09:45:09.133-07:00</atom:updated><title>MySQL Information Functions</title><description>&lt;table border=&quot;0&quot;&gt;&lt;thead&gt; &lt;tr&gt; &lt;th  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span class=&quot;bold&quot;&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/th&gt; &lt;th  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span class=&quot;bold&quot;&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;BENCHMARK()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Repeatedly execute an expression&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;code class=&quot;literal&quot;&gt;CHARSET()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/span&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the character set of the argument&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;code class=&quot;literal&quot;&gt;COERCIBILITY()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/span&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the collation coercibility value of the string argument&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;code class=&quot;literal&quot;&gt;COLLATION()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/span&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the collation of the string argument&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;CONNECTION_ID()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the connection ID (thread ID) for the connection&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;CURRENT_USER()&lt;/code&gt;, &lt;code class=&quot;literal&quot;&gt;CURRENT_USER&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the username and hostname combination&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;DATABASE()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the default (current) database name&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;FOUND_ROWS()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;For a SELECT with a LIMIT clause, the number of rows that would be returned  were there no LIMIT clause&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;LAST_INSERT_ID()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Value of the AUTOINCREMENT column for the last INSERT&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;code class=&quot;literal&quot;&gt;ROW_COUNT()&lt;/code&gt;&lt;/a&gt;(v5.0.1)&lt;/span&gt;&lt;/td&gt; &lt;td  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;The number of rows updated&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;code class=&quot;literal&quot;&gt;SCHEMA()&lt;/code&gt;&lt;/a&gt;(v5.0.2)&lt;/span&gt;&lt;/td&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;A synonym for DATABASE()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;SESSION_USER()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Synonym for USER()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;SYSTEM_USER()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Synonym for USER()&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;USER()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Return the current username and hostname&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/information-functions.html&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;VERSION()&lt;/code&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt; &lt;td face=&quot;trebuchet ms&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Returns a string that indicates the MySQL server version&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description><link>http://techknowledges.blogspot.com/2007/10/mysql-information-functions.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-7404289909826195811</guid><pubDate>Fri, 19 Oct 2007 16:32:00 +0000</pubDate><atom:updated>2007-10-19T09:32:15.289-07:00</atom:updated><title>MySQL Cursors</title><description>&lt;p style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;DECLARE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;cursor_name&lt;/code&gt;&lt;/em&gt; CURSOR FOR &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;select_statement&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;OPEN &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;cursor_name&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;FETCH &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;cursor_name&lt;/code&gt;&lt;/em&gt; INTO &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt; [, &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt;] ...&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;font-family: trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;CLOSE &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;cursor_name&lt;/code&gt;&lt;/em&gt;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    Cursors are supported inside stored procedures and functions and triggers.  The syntax is as in embedded SQL. Cursors are currently asensitive, read-only,  and non-scrolling. Asensitive means that the server may or may not make a copy  of its result table. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    Cursors must be declared before declaring handlers, and variables and  conditions must be declared before declaring either cursors or handlers.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;Ex&lt;br /&gt;CREATE PROCEDURE curdemo()&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE done INT DEFAULT 0;&lt;br /&gt; DECLARE a CHAR(16);&lt;br /&gt; DECLARE b,c INT;&lt;br /&gt; DECLARE cur1 CURSOR FOR SELECT id,data FROM test.t1;&lt;br /&gt; DECLARE cur2 CURSOR FOR SELECT i FROM test.t2;&lt;br /&gt; DECLARE CONTINUE HANDLER FOR SQLSTATE &#39;02000&#39; SET done = 1;&lt;br /&gt;&lt;br /&gt; OPEN cur1;&lt;br /&gt; OPEN cur2;&lt;br /&gt;&lt;br /&gt; REPEAT&lt;br /&gt;   FETCH cur1 INTO a, b;&lt;br /&gt;   FETCH cur2 INTO c;&lt;br /&gt;   IF NOT done THEN&lt;br /&gt;      IF b &lt; c THEN&lt;br /&gt;         INSERT INTO test.t3 VALUES (a,b);&lt;br /&gt;      ELSE&lt;br /&gt;         INSERT INTO test.t3 VALUES (a,c);&lt;br /&gt;      END IF;&lt;br /&gt;   END IF;&lt;br /&gt; UNTIL done END REPEAT;&lt;br /&gt;&lt;br /&gt; CLOSE cur1;&lt;br /&gt; CLOSE cur2;&lt;br /&gt;END&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;</description><link>http://techknowledges.blogspot.com/2007/10/mysql-cursors.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-3900337996206444647</guid><pubDate>Fri, 19 Oct 2007 16:04:00 +0000</pubDate><atom:updated>2007-10-19T09:04:42.090-07:00</atom:updated><title>MySQL Alter and Drop Procedure, Function</title><description>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;Alter Procedure and Function&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;     ALTER {PROCEDURE | FUNCTION} &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;    sp_name&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; [&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;characteristic&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; ...]  &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;characteristic&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;: &lt;br /&gt;   { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }&lt;br /&gt;   | SQL SECURITY { DEFINER | INVOKER }   | COMMENT &#39;&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;string&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;Drop Procedure and Function&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    DROP {PROCEDURE | FUNCTION} [IF EXISTS] &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;sp_name&lt;/code&gt;&lt;/em&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;</description><link>http://techknowledges.blogspot.com/2007/10/alter-procedure-and-function.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-6727292896822478587</guid><pubDate>Fri, 19 Oct 2007 16:04:00 +0000</pubDate><atom:updated>2007-10-19T09:04:20.570-07:00</atom:updated><title>MySQL Call Statement Syntax</title><description>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;CALL &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;sp_name&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;([&lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;parameter&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;[,...]]) CALL &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;sp_name&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;[()]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;Ex Call Statement&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre  class=&quot;programlisting&quot; style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;CREATE PROCEDURE p (OUT ver_param VARCHAR(25), INOUT incr_param INT)&lt;br /&gt;BEGIN&lt;br /&gt;# Set value of OUT parameter&lt;br /&gt;SELECT VERSION() INTO ver_param;&lt;br /&gt;# Increment value of INOUT parameter&lt;br /&gt;SET incr_param = incr_param + 1;&lt;br /&gt;END;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SET @increment = 10;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;CALL p(@version, @increment);&lt;br /&gt;&lt;/code&gt;&lt;/strong&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql&gt; &lt;/span&gt;&lt;strong style=&quot;font-family: trebuchet ms;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT @version, @increment;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; +------------+------------+ &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;| @version   | @increment | &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;+------------+------------+&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; | 5.0.25-log | 11         |&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; +------------+------------+&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql_query(mysql, &quot;CALL p1(@param1, @param2)&quot;); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql_query(mysql, &quot;SELECT @param1, @param2&quot;); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;result = mysql_store_result(mysql); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;row = mysql_fetch_row(result); &lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;mysql_free_result(result); &lt;/span&gt;&lt;/span&gt;</description><link>http://techknowledges.blogspot.com/2007/10/call-statement-syntax.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-5190171220513298858</guid><pubDate>Fri, 19 Oct 2007 16:03:00 +0000</pubDate><atom:updated>2007-10-19T09:03:47.677-07:00</atom:updated><title>MySQL BEGIN ... END Compound and DECLARE Statement Syntax</title><description>&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;code style=&quot;font-family: lucida grande; font-weight: bold;&quot; class=&quot;literal&quot;&gt;BEGIN ... END&lt;/code&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt; Compound Statement Syntax&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;pre class=&quot;programlisting&quot;  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;[&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;begin_label&lt;/code&gt;&lt;/em&gt;:] BEGIN&lt;br /&gt; [&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;statement_list&lt;/code&gt;&lt;/em&gt;]&lt;br /&gt;END [&lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;end_label&lt;/code&gt;&lt;/em&gt;]&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;BEGIN ... END&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; syntax is used for writing compound  statements, which can appear within stored routines and triggers. A compound  statement can contain multiple statements, enclosed by the &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;BEGIN&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; and &lt;/span&gt;&lt;code style=&quot;font-family: trebuchet ms;&quot; class=&quot;literal&quot;&gt;END&lt;/code&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; keywords&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold;font-size:100%;&quot; &gt;&lt;code style=&quot;font-family: lucida grande;&quot; class=&quot;literal&quot;&gt;DECLARE&lt;/code&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt; Statement Syntax&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;DECLARE &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;[,...] &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt; [DEFAULT &lt;/span&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/em&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;] &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-size:85%;&quot; &gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    This statement is used to declare local variables. To provide a default value  for the variable, include a &lt;code class=&quot;literal&quot;&gt;DEFAULT&lt;/code&gt; clause. The value  can be specified as an expression; it need not be a constant. If the &lt;code class=&quot;literal&quot;&gt;DEFAULT&lt;/code&gt; clause is missing, the initial value is &lt;code class=&quot;literal&quot;&gt;NULL&lt;/code&gt;.&lt;br /&gt;&lt;code class=&quot;literal&quot;&gt;&lt;/code&gt;    The scope of a local variable is within the &lt;code class=&quot;literal&quot;&gt;BEGIN ...  END&lt;/code&gt; block where it is declared. The variable can be referred to in blocks  nested within the declaring block, except those blocks that declare a variable  with the same name.&lt;/span&gt;&lt;br /&gt;&lt;div class=&quot;section&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;section&quot; lang=&quot;en&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;&lt;br /&gt;&lt;br /&gt;Variable &lt;/span&gt;&lt;code style=&quot;font-weight: bold; font-family: lucida grande;&quot; class=&quot;literal&quot;&gt;SET&lt;/code&gt; &lt;span style=&quot;font-weight: bold;&quot;&gt;Statement&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;SET &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt; = &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr&lt;/code&gt;&lt;/em&gt; [, &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt; = &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;expr&lt;/code&gt;&lt;/em&gt;] ... &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    The &lt;code class=&quot;literal&quot;&gt;SET&lt;/code&gt; statement in stored routines is an  extended version of the general &lt;code class=&quot;literal&quot;&gt;SET&lt;/code&gt; statement.  Referenced variables may be ones declared inside a routine, or global system  variables. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;    The &lt;code class=&quot;literal&quot;&gt;SET&lt;/code&gt; statement in stored routines is  implemented as part of the pre-existing &lt;code class=&quot;literal&quot;&gt;SET&lt;/code&gt; syntax.  This allows an extended syntax of &lt;code class=&quot;literal&quot;&gt;SET a=x, b=y, ...&lt;/code&gt;  where different variable types (locally declared variables and global and  session server variables) can be mixed. This also allows combinations of local  variables and some options that make sense only for system variables; in that  case, the options are recognized but ignored.&lt;/span&gt; &lt;/p&gt;&lt;/div&gt;&lt;!--UdmComment--&gt;&lt;p  style=&quot;font-weight: bold;font-family:lucida grande;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;code class=&quot;literal&quot;&gt;SELECT ... INTO&lt;/code&gt; Statement&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;SELECT &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;col_name&lt;/code&gt;&lt;/em&gt;[,...] INTO &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;var_name&lt;/code&gt;&lt;/em&gt;[,...] &lt;em class=&quot;replaceable&quot;&gt;&lt;code&gt;table_expr&lt;/code&gt;&lt;/em&gt;&lt;/span&gt; &lt;/pre&gt; &lt;p  style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;This &lt;code class=&quot;literal&quot;&gt;SELECT&lt;/code&gt; syntax stores selected columns  directly into variables. Therefore, only a single row may be retrieved. &lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;SELECT id,data INTO x,y FROM test.t1 LIMIT 1;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; font-style: italic;font-size:130%;&quot; &gt;Important&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class=&quot;important&quot;  style=&quot;margin-left: 0.5in; margin-right: 0.5in;font-family:courier new;&quot;&gt; &lt;p&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;SQL variable names should not be the same as column names. If an SQL  statement, such as a &lt;code class=&quot;literal&quot;&gt;SELECT ... INTO&lt;/code&gt; statement,  contains a reference to a column and a declared local variable with the same  name, MySQL currently interprets the reference as the name of a variable. For  example, in the following statement, &lt;code class=&quot;literal&quot;&gt;xname&lt;/code&gt; is  interpreted as a reference to the &lt;code class=&quot;literal&quot;&gt;xname&lt;/code&gt; &lt;span class=&quot;emphasis&quot;&gt;&lt;em&gt;variable&lt;/em&gt;&lt;/span&gt; rather than the &lt;code class=&quot;literal&quot;&gt;xname&lt;/code&gt;&lt;span class=&quot;emphasis&quot;&gt;&lt;em&gt;column&lt;/em&gt;&lt;/span&gt;:  &lt;/span&gt; &lt;/p&gt;&lt;/div&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;font-family:trebuchet ms;&quot; &gt;Ex&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;CREATE PROCEDURE sp1 (x VARCHAR(5))&lt;br /&gt;BEGIN&lt;br /&gt; DECLARE xname VARCHAR(5) DEFAULT &#39;bob&#39;;&lt;br /&gt; DECLARE newname VARCHAR(5);&lt;br /&gt; DECLARE xid INT;&lt;br /&gt;&lt;br /&gt; SELECT xname,id INTO newname,xid&lt;br /&gt;   FROM table1 WHERE xname = xname;&lt;br /&gt; SELECT newname;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;  END;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!--UdmComment--&gt;</description><link>http://techknowledges.blogspot.com/2007/10/begin-end-compound-and-declare.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-2364985010106295591</guid><pubDate>Fri, 19 Oct 2007 15:04:00 +0000</pubDate><atom:updated>2007-10-19T08:04:56.698-07:00</atom:updated><title>MySQL Create Procedure and Function</title><description>&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:130%;&quot;&gt;&lt;span style=&quot;font-weight: bold;font-family:lucida grande;&quot; &gt;Create Procedure and Function&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;Create Procedure&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;   &lt;span style=&quot;font-size:85%;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         [DEFINER = { &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;user&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; | CURRENT_USER }]&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         PROCEDURE &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;sp_name&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; ([&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;proc_parameter&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;[,...]])&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         [&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;characteristic&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; ...] &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;routine_body&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;br /&gt;Create Function&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre class=&quot;programlisting&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;   &lt;span style=&quot;font-size:85%;&quot;&gt;CREATE&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         [DEFINER = { &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;user&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; | CURRENT_USER }]&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         FUNCTION &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;sp_name&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; ([&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;func_parameter&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;[,...]])&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         RETURNS &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         [&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;characteristic&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; ...] &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;routine_body&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;    &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;  proc_parameter&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;:&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         [ IN | OUT | INOUT ] &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;param_name&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;    &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;  func_parameter&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;:&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;      &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;        param_name&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;type&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;  type&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;:&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;         &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;Any valid MySQL data type&lt;/code&gt;&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;   characteristic&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;:&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;       LANGUAGE SQL&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;| [NOT] DETERMINISTIC&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;|&lt;br /&gt;   { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA } |&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;       SQL SECURITY { DEFINER | INVOKER }&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt; | COMMENT &#39;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;string&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;&#39;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt; routine_body&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;:&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;;font-family:trebuchet ms;font-size:85%;&quot;  &gt;    &lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;em style=&quot;font-family: trebuchet ms;&quot; class=&quot;replaceable&quot;&gt;&lt;code&gt;  Valid SQL procedure statement&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;Ex Create Procedure&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;delimiter //&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;CREATE PROCEDURE simpleproc (OUT param1 INT)&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      -&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;BEGIN&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      -&gt;   &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT COUNT(*) INTO param1 FROM t;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      -&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;END;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      -&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;//&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;delimiter ;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;CALL simpleproc(@a);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT @a;&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      +------+&lt;br /&gt;      | @a   |&lt;br /&gt;      +------+&lt;br /&gt;      | 3    |&lt;br /&gt;      +------+&lt;br /&gt;      1 row in set (0.00 sec)&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size:100%;&quot;&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;Ex Create Function&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;   -&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;RETURN CONCAT(&#39;Hello, &#39;,s,&#39;!&#39;);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;mysql&gt; &lt;strong style=&quot;font-weight: normal;&quot; class=&quot;userinput&quot;&gt;&lt;code&gt;SELECT hello(&#39;world&#39;);&lt;/code&gt;&lt;/strong&gt;&lt;br /&gt;      +----------------+&lt;br /&gt;      | hello(&#39;world&#39;) |&lt;br /&gt;      +----------------+&lt;br /&gt;      | Hello, world!  |&lt;br /&gt;      +----------------+&lt;br /&gt;      1 row in set (0.00 sec)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;</description><link>http://techknowledges.blogspot.com/2007/10/mysql-create-alter-procedure-and.html</link><author>noreply@blogger.com (pompa)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1920678676299289558.post-3382560010773784659</guid><pubDate>Sun, 14 Oct 2007 12:28:00 +0000</pubDate><atom:updated>2007-10-14T05:28:32.797-07:00</atom:updated><title>Oracle Export and Import Database</title><description>&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;font-family:lucida grande;&quot;&gt;Export/Import Data to Database&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;strong&gt;Export&lt;/strong&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;C:\&gt;EXP UserName/Password@DB FILE=Name_Of_Dump_File.dmp TABLES=Name_Of_Table_For_Export QUERY=\&quot;Where_Clause\&quot; LOG=Name_Of_Log_File.log&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:trebuchet ms;&quot;&gt;&lt;strong&gt;Import &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:trebuchet ms;font-size:85%;&quot;&gt;C:\&gt;IMP UserName/Password@DB FILE=Name_Of_Dump_File.dmp FROMUSER=UserName_In_DB_Old TOUSER=UserName_In_DB_New TABLES=Name_Of_Table_For_Import IGNORE=Y CONSTRAINTS=N LOG=Name_Of_Log_File.log&lt;/span&gt;&lt;/p&gt;</description><link>http://techknowledges.blogspot.com/2007/10/oracle-export-and-import-database.html</link><author>noreply@blogger.com (pompa)</author><thr:total>0</thr:total></item></channel></rss>