锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲男人av香蕉爽爽爽爽,亚洲女人被黑人巨大进入,在线91精品亚洲网站精品成人http://www.tkk7.com/huhu/category/9422.htmlHuhu'Blogzh-cnWed, 28 Feb 2007 13:51:49 GMTWed, 28 Feb 2007 13:51:49 GMT60NVL Function銆怬racle/PLSQL銆戯紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/39362.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Wed, 05 Apr 2006 05:38:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/39362.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/39362.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/39362.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/39362.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/39362.html</trackback:ping><description><![CDATA[ <p>In Oracle/PLSQL, the <b>NVL</b> function lets you substitute a value when a null value is encountered.</p> <p>The syntax for the <b>NVL</b> function is:</p> <blockquote> <blockquote class="definition"> <p>NVL( string1, replace_with )</p> </blockquote> </blockquote> <p> <i>string1</i> is the string to test for a null value.</p> <p> <i>replace_with</i> is the value returned if <i>string1</i> is null.</p> <br /> <p> <u>Example #1:</u> </p> <blockquote class="sql_command"> <p>select NVL(supplier_city, 'n/a')<br />from suppliers;</p> </blockquote> <p>The SQL statement above would return 'n/a' if the supplier_city field contained a null value. Otherwise, it would return the supplier_city value.</p> <br /> <p> <u>Example #2:</u> </p> <blockquote class="sql_command"> <p>select supplier_id,<br />NVL(supplier_desc, supplier_name)<br />from suppliers;</p> </blockquote> <p>This SQL statement would return the <i>supplier_name</i> field if the <i>supplier_desc</i> contained a null value. Otherwise, it would return the <i>supplier_desc</i>.</p> <br /> <p> <u>Example #3:</u> </p> <blockquote class="sql_command"> <p>select NVL(commission, 0)<br />from sales;</p> </blockquote> <p>This SQL statement would return 0 if the <i>commission</i> field contained a null value. Otherwise, it would return the <i>commission</i> field.</p> <br /> <h2>Frequently Asked Questions</h2> <hr /> <p> <b>Question</b>:聽 I tried to use the NVL function through VB to access Oracle DB.</p> <p>To be precise,</p> <blockquote> <p>select NVL(DIstinct (emp_name),'AAA'),................ from.................</p> </blockquote> <p>I got an oracle error when I use distinct clause with NVL, but when I remove distinct it works fine.</p> <p> <b>Answer</b>:聽 It is possible to the use the DISTINCT clause with the NVL function. However, the DISTINCT must come before the use of the NVL function. For example:</p> <blockquote class="sql_command"> <p>select distinct NVL(emp_name, 'AAA')<br />from employees;</p> </blockquote> <p>Hope this helps!</p> <hr /> <p> <b>Question</b>:聽 Is it possible to use the NVL function with more than one column with the same function call?聽 To be clear, if i need to apply this NVL function to more than one column like this:</p> <blockquote> <p>NVL(column1;column2 ...... , here is the default value for all )</p> </blockquote> <p> <b>Answer</b>:聽 You will need to make separate NVL function calls for each column. For example:</p> <blockquote class="sql_command"> <p>select NVL(table_name, 'not found'), NVL(owner, 'not found')<br />from all_tables;</p> </blockquote> <!-- InstanceEndEditable --> <img src ="http://www.tkk7.com/huhu/aggbug/39362.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-05 13:38 <a href="http://www.tkk7.com/huhu/articles/39362.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Decode Function銆怬racle/PLSQL銆戯紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/39124.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Tue, 04 Apr 2006 04:51:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/39124.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/39124.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/39124.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/39124.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/39124.html</trackback:ping><description><![CDATA[ <p>In Oracle/PLSQL, the <b>decode</b> function has the functionality of an IF-THEN-ELSE statement.</p> <p>The syntax for the <b>decode</b> function is:</p> <blockquote> <blockquote class="definition"> <p>decode( expression , search , result [, search , result]... [, default] )</p> </blockquote> </blockquote> <p> <i>expression</i> is the value to compare.</p> <p> <i>search</i> is the value that is compared against <i>expression</i>.</p> <p> <i>result</i> is the value returned, if <i>expression</i> is equal to <i>search</i>.</p> <p> <i>default</i> is optional. If no matches are found, the decode will return <i>default</i>. If <i>default</i> is omitted, then the decode statement will return null (if no matches are found).</p> <br /> <p> <u>For Example:</u> </p> <p>You could use the decode function in an SQL statement as follows:</p> <blockquote> <div align="left"> <table class="sql_command" cellspacing="0" cellpadding="0" width="400" border="0"> <tbody> <tr> <td width="398" colspan="3">SELECT supplier_name,</td> </tr> <tr> <td width="121">decode(supplier_id,</td> <td width="47">10000,</td> <td width="226">'IBM',</td> </tr> <tr> <td width="121"> </td> <td width="47">10001,</td> <td width="226">'Microsoft',</td> </tr> <tr> <td width="121"> </td> <td width="47">10002,</td> <td width="226">'Hewlett Packard',</td> </tr> <tr> <td width="121"> </td> <td width="47"> </td> <td width="226">'Gateway') result</td> </tr> <tr> <td width="398" colspan="3">FROM suppliers;</td> </tr> </tbody> </table> </div> </blockquote> <br /> <p>The above decode statement is equivalent to the following IF-THEN-ELSE statement:</p> <blockquote class="sql_command"> <p>IF supplier_id = 10000 THEN<br />聽聽聽聽 result := 'IBM';</p> <p>ELSIF supplier_id = 10001 THEN<br />聽聽聽 result := 'Microsoft';</p> <p>ELSIF supplier_id = 10002 THEN<br />聽聽聽 result := 'Hewlett Packard';</p> <p>ELSE<br />聽聽聽 result := 'Gateway';</p> <p>END IF;</p> </blockquote> <br /> <p>The decode function will compare each supplier_id value, one by one.</p> <br /> <h2>Frequently Asked Questions</h2> <hr /> <p> <b>Question</b>:聽 One of our viewers wanted to know how to use the decode function to compare two dates (ie: date1 and date2), where if date1 > date2, the decode function should return date2. Otherwise, the decode function should return date1.</p> <p> <b>Answer</b>:聽 To accomplish this, use the decode function as follows:</p> <blockquote class="sql_command"> <p>decode((date1 - date2) - abs(date1 - date2), 0, date2, date1)</p> </blockquote> <p>The formula below would equal 0, if date1 is greater than date2:</p> <blockquote> <p>(date1 - date2) - abs(date1 - date2)</p> </blockquote> <hr /> <p> <b>Question</b>:聽 I would like to know if it's possible to use decode for ranges of numbers, ie 1-10 = 'category 1', 11-20 = 'category 2', rather than having to individually decode each number.</p> <p> <b>Answer</b>: Unfortunately, you can not use the decode for ranges of numbers. However, you can try to create a formula that will evaluate to one number for a given range, and another number for the next range, and so on.</p> <p>For example:</p> <blockquote> <div align="left"> <table class="sql_command" cellspacing="0" cellpadding="0" width="443" border="0"> <tbody> <tr> <td width="398" colspan="3">SELECT supplier_id,</td> </tr> <tr> <td width="221">decode(trunc ((supplier_id - 1) / 10),</td> <td width="38">0,</td> <td width="178">'category 1',</td> </tr> <tr> <td width="221"> </td> <td width="38">1,</td> <td width="178">'category 2',</td> </tr> <tr> <td width="221"> </td> <td width="38">2,</td> <td width="178">'category 3',</td> </tr> <tr> <td width="221"> </td> <td width="38"> </td> <td width="178">'unknown') result</td> </tr> <tr> <td width="398" colspan="3">FROM suppliers;</td> </tr> </tbody> </table> </div> </blockquote> <p>In this example, based on the formula:</p> <blockquote> <p>trunc ((supplier_id - 1) / 10</p> </blockquote> <p>The formula will evaluate to 0, if the supplier_id is between 1 and 10.<br />The formula will evaluate to 1, if the supplier_id is between 11 and 20.<br />The formula will evaluate to 2, if the supplier_id is between 21 and 30.</p> <p>and so on...</p> <hr /> <p> <b>Question</b>:聽 I need to write a decode statement that will return the following:</p> <blockquote> <p>If yrs_of_service < 1 then return 0.04<br />If yrs_of_service >= 1 and < 5 then return 0.04<br />If yrs_of_service > 5 then return 0.06</p> </blockquote> <p>How can I do this?</p> <p> <b>Answer</b>:聽 You will need to create a formula that will evaluate to a single number for each one of your ranges.</p> <p>For example:</p> <blockquote> <table class="sql_command" cellspacing="0" cellpadding="0" width="443" border="0"> <tbody> <tr> <td width="398" colspan="3">SELECT emp_name,</td> </tr> <tr> <td width="235">decode(trunc (( yrs_of_service + 3) / 4),</td> <td width="24">0,</td> <td width="178">0.04,</td> </tr> <tr> <td width="235"> </td> <td width="24">1,</td> <td width="178">0.04,</td> </tr> <tr> <td width="235"> </td> <td width="24"> </td> <td width="178">0.06) as perc_value</td> </tr> <tr> <td width="398" colspan="3">FROM employees;</td> </tr> </tbody> </table> </blockquote> <hr /> <p> <b>Helpful Tip</b>: One of our viewers suggested combining the <a ><font color="#002c99">SIGN function</font></a> with the DECODE function as follows:</p> <p>The date example above could be modified as follows:</p> <blockquote class="sql_command"> <p>DECODE(SIGN(date1-date2), 1, date2, date1)</p> </blockquote> <p>The SIGN/DECODE combination is also helpful for numeric comparisons e.g. Sales Bonuses</p> <blockquote class="sql_command"> <p>DECODE(SIGN(actual-target), -1, 'NO Bonus for you', 0,'Just made it', 1, 'Congrats, you are a winner')</p> </blockquote> <!-- InstanceEndEditable --> <img src ="http://www.tkk7.com/huhu/aggbug/39124.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-04 12:51 <a href="http://www.tkk7.com/huhu/articles/39124.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>To_Char Function銆怬racle/PLSQL:銆戯紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/39100.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Tue, 04 Apr 2006 02:33:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/39100.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/39100.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/39100.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/39100.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/39100.html</trackback:ping><description><![CDATA[ <p>In Oracle/PLSQL, the <b>to_char</b> function converts a number or date to a string.</p> <p>The syntax for the <b>to_char</b> function is:</p> <blockquote> <blockquote class="definition"> <p>to_char( value, [ format_mask ], [ nls_language ] )</p> </blockquote> </blockquote> <p> <i>value</i> can either be a number or date that will be converted to a string.</p> <p> <i>format_mask</i> is optional. This is the format that will be used to convert <i>value</i> to a string.</p> <p> <i>nls_language</i> is optional. This is the nls language used to convert <i>value</i> to a string.</p> <br /> <h2>Examples - Numbers</h2> <p>The following are number examples for the <b>to_char</b> function.</p> <blockquote> <table cellspacing="0" cellpadding="3" width="432" border="0"> <tbody> <tr> <td class="function_example" width="207">to_char(1210.73, '9999.9')</td> <td class="function_desc">would return '1210.7'</td> </tr> <tr> <td class="function_example">to_char(1210.73, '9,999.99')</td> <td class="function_desc">would return '1,210.73'</td> </tr> <tr> <td class="function_example">to_char(1210.73, '$9,999.00')</td> <td class="function_desc">would return '$1,210.73'</td> </tr> <tr> <td class="function_example">to_char(21, '000099')</td> <td class="function_desc">would return '000021'</td> </tr> </tbody> </table> </blockquote> <br /> <h2>Examples - Dates</h2> <p>The following is a list of valid parameters when the <b>to_char</b> function is used to convert a date to a string. These parameters can be used in many combinations.</p> <blockquote> <table class="parm_values" cellspacing="0" cellpadding="3" width="500" border="1"> <tbody> <tr class="th_left_top"> <th width="93">Parameter</th> <th>Explanation</th> </tr> <tr class="tr_left_top"> <td>YEAR</td> <td>Year, spelled out</td> </tr> <tr class="tr_left_top"> <td>YYYY</td> <td>4-digit year</td> </tr> <tr class="tr_left_top"> <td>YYY<br />YY<br />Y</td> <td>Last 3, 2, or 1 digit(s) of year.</td> </tr> <tr class="tr_left_top"> <td>IYY<br />IY<br />I</td> <td>Last 3, 2, or 1 digit(s) of ISO year.</td> </tr> <tr class="tr_left_top"> <td>IYYY</td> <td>4-digit year based on the ISO standard</td> </tr> <tr class="tr_left_top"> <td>Q</td> <td>Quarter of year (1, 2, 3, 4; JAN-MAR = 1).</td> </tr> <tr class="tr_left_top"> <td>MM</td> <td>Month (01-12; JAN = 01).</td> </tr> <tr class="tr_left_top"> <td>MON</td> <td>Abbreviated name of month.</td> </tr> <tr class="tr_left_top"> <td>MONTH</td> <td>Name of month, padded with blanks to length of 9 characters.</td> </tr> <tr class="tr_left_top"> <td>RM</td> <td>Roman numeral month (I-XII; JAN = I).</td> </tr> <tr class="tr_left_top"> <td>WW</td> <td>Week of year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.</td> </tr> <tr class="tr_left_top"> <td>W</td> <td>Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh.</td> </tr> <tr class="tr_left_top"> <td>IW</td> <td>Week of year (1-52 or 1-53) based on the ISO standard.</td> </tr> <tr class="tr_left_top"> <td>D</td> <td>Day of week (1-7).</td> </tr> <tr class="tr_left_top"> <td>DAY</td> <td>Name of day.</td> </tr> <tr class="tr_left_top"> <td>DD</td> <td>Day of month (1-31).</td> </tr> <tr class="tr_left_top"> <td>DDD</td> <td>Day of year (1-366).</td> </tr> <tr class="tr_left_top"> <td>DY</td> <td>Abbreviated name of day.</td> </tr> <tr class="tr_left_top"> <td>J</td> <td>Julian day; the number of days since January 1, 4712 BC.</td> </tr> <tr class="tr_left_top"> <td>HH</td> <td>Hour of day (1-12).</td> </tr> <tr class="tr_left_top"> <td>HH12</td> <td>Hour of day (1-12).</td> </tr> <tr class="tr_left_top"> <td>HH24</td> <td>Hour of day (0-23).</td> </tr> <tr class="tr_left_top"> <td>MI</td> <td>Minute (0-59).</td> </tr> <tr class="tr_left_top"> <td>SS</td> <td>Second (0-59).</td> </tr> <tr class="tr_left_top"> <td>SSSSS</td> <td>Seconds past midnight (0-86399).</td> </tr> <tr class="tr_left_top"> <td>FF</td> <td>Fractional seconds.</td> </tr> </tbody> </table> </blockquote> <br /> <p>The following are date examples for the <b>to_char</b> function.</p> <blockquote> <table cellspacing="0" cellpadding="3" width="460" border="0"> <tbody> <tr> <td class="function_example" width="253">to_char(sysdate, 'yyyy/mm/dd');</td> <td class="function_desc">would return '2003/07/09'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'Month DD, YYYY');</td> <td class="function_desc">would return 'July 09, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'FMMonth DD, YYYY');</td> <td class="function_desc">would return 'July 9, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'MON DDth, YYYY');</td> <td class="function_desc">would return 'JUL 09TH, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'FMMON DDth, YYYY');</td> <td class="function_desc">would return 'JUL 9TH, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'FMMon ddth, YYYY');</td> <td class="function_desc">would return 'Jul 9th, 2003'</td> </tr> </tbody> </table> </blockquote> <br /> <p>You will notice that in some examples, the <i>format_mask</i> parameter begins with "FM". This means that zeros and blanks are suppressed. This can be seen in the examples below.</p> <blockquote> <table cellspacing="0" cellpadding="3" width="460" border="0"> <tbody> <tr> <td class="function_example" width="253">to_char(sysdate, 'FMMonth DD, YYYY');</td> <td class="function_desc">would return 'July 9, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'FMMON DDth, YYYY');</td> <td class="function_desc">would return 'JUL 9TH, 2003'</td> </tr> <tr> <td class="function_example">to_char(sysdate, 'FMMon ddth, YYYY');</td> <td class="function_desc">would return 'Jul 9th, 2003'</td> </tr> </tbody> </table> </blockquote> <p>The zeros have been suppressed so that the day component shows as "9" as opposed to "09".</p> <br /> <h2>Frequently Asked Questions</h2> <hr /> <p> <b>Question</b>:聽 Why doesn't this sort the day's of the week in order?</p> <blockquote> <p>select ename, hiredate, to_char((hiredate),'fmDay') "Day"<br />from emp<br />order by "Day";</p> </blockquote> <p> <b>Answer</b>:</p> <p>The fmDay parameter will return the name of the Day and not the numeric value of the day.<br />Try the following:</p> <blockquote class="sql_command"> <p>select ename, hiredate, to_char((hiredate),'fmDD') "Day"<br />from emp<br />order by "Day";</p> </blockquote> <!-- InstanceEndEditable --> <img src ="http://www.tkk7.com/huhu/aggbug/39100.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-04 10:33 <a href="http://www.tkk7.com/huhu/articles/39100.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Coalesce Function銆怬racle/PLSQL銆戯紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/39094.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Tue, 04 Apr 2006 02:15:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/39094.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/39094.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/39094.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/39094.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/39094.html</trackback:ping><description><![CDATA[ <p>In Oracle/PLSQL, the <b>coalesce</b> function returns the first non-null expression in the list. If all expressions evaluate to null, then the coalesce function will return null.</p> <p>The syntax for the <b>coalesce</b> function is:</p> <blockquote> <blockquote class="definition"> <p>coalesce( expr1, expr2, ... expr_n )</p> </blockquote> </blockquote> <br /> <p> <u>For Example:</u> </p> <p>You could use the coalesce function in an SQL statement as follows:</p> <blockquote class="sql_command"> <p>SELECT coalesce( address1, address2, address3 ) result<br />FROM suppliers;</p> </blockquote> <br /> <p>The above coalesce statement is equivalent to the following IF-THEN-ELSE statement:</p> <blockquote class="sql_command"> <p>IF address1 is not null THEN<br />聽聽聽聽 result := address1;</p> <p>ELSIF address2 is not null THEN<br />聽聽聽 result := address2;</p> <p>ELSIF address3 is not null THEN<br />聽聽聽 result := address3;</p> <p>ELSE<br />聽聽聽 result := null;</p> <p>END IF;</p> </blockquote> <br /> <p>The coalesce function will compare each value, one by one.</p> <!-- InstanceEndEditable --> <img src ="http://www.tkk7.com/huhu/aggbug/39094.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-04 10:15 <a href="http://www.tkk7.com/huhu/articles/39094.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>String Functions銆怬racle銆?杞澆)http://www.tkk7.com/huhu/articles/39080.html浼兼按嫻佸勾浼兼按嫻佸勾Tue, 04 Apr 2006 01:25:00 GMThttp://www.tkk7.com/huhu/articles/39080.htmlhttp://www.tkk7.com/huhu/comments/39080.htmlhttp://www.tkk7.com/huhu/articles/39080.html#Feedback0http://www.tkk7.com/huhu/comments/commentRss/39080.htmlhttp://www.tkk7.com/huhu/services/trackbacks/39080.html
ASCII
Get The ASCII Value Of A Character ASCII(<string_or_column>)
SELECT ASCII('A') FROM dual;
SELECT ASCII('Z') FROM dual;
SELECT ASCII('a') FROM dual;
SELECT ASCII('z') FROM dual;
SELECT ASCII(' ') FROM dual;
CASE Related Functions
Upper Case UPPER(<string_or_column>)
SELECT UPPER('Dan Morgan') FROM dual;
Lower Case LOWER(<string_or_column>)
SELECT LOWER('Dan Morgan') FROM dual;
Initial Letter Upper Case INITCAP(<string_or_column>)
SELECT INITCAP('DAN MORGAN') FROM dual;
NLS Upper Case NLS_UPPER(<string_or_column>)
SELECT NLS_UPPER('Dan Morgan', 'NLS_SORT = XDanish')
FROM dual;
NLS Lower Case NLS_LOWER(<string_or_column>)
SELECT NLS_LOWER('Dan Morgan', 'NLS_SORT = XFrench')
FROM dual;
NLS Initial Letter Upper Case NLS_INITCAP(<string_or_column>)
SELECT NLS_INITCAP('DAN MORGAN', 'NLS_SORT = XGerman')
FROM dual;
CHR
Character CHR(<ascii_string_or_column>>)
SELECT(CHR(68) || CHR(65) || CHR(78)) FROM dual;

SELECT(CHR(68) || CHR(97) || CHR(110)) FROM dual;
COALESCE
Returns the first non-null occurrence COALESCE(<value>, <value>, <value>, ...)
CREATE TABLE test (
col1聽 VARCHAR2(1),
col2聽 VARCHAR2(1),
col3聽 VARCHAR2(1));

INSERT INTO test VALUES (NULL, 'B', 'C');
INSERT INTO test VALUES ('A', NULL, 'C');
INSERT INTO test VALUES (NULL, NULL, 'C');
INSERT INTO test VALUES ('A', 'B', 'C');

SELECT COALESCE(col1, col2, col3) FROM test;
CONCAT
Concatenate CONCAT(<first_string_or_column>>, <second_string_or_column>>)
SELECT CONCAT('Dan ', 'Morgan') FROM dual;
CONVERT
Converts From One Character Set To Another CONVERT(<character>,<destination_character_set>,
<source_character_set>)
SELECT CONVERT('?????A B C D E','US7ASCII','WE8ISO8859P1')
FROM dual;
INSTR
See links at page bottom
LENGTH
String Length LENGTH(<string_or_column>)
SELECT LENGTH('Dan Morgan') FROM dual;
LPAD
Left Pad LPAD(<string_or_column>, <final_length>, <padding_character>)
SELECT LPAD('Dan Morgan', 25, 'x') FROM dual;
LTRIM
Left Trim LTRIM(<string_or_column>)
SELECT LTRIM('聽聽 Dan Morgan聽聽 ') FROM dual;
NLSSORT
Returns the string of bytes used to sort a string.

The string returned is of RAW data type
NLSSORT(<column_name>, 'NLS_SORT = <NLS Parameter>);
CREATE TABLE test (name VARCHAR2(15));
INSERT INTO test VALUES ('Gaardiner');
INSERT INTO test VALUES ('Gaberd');
INSERT INTO test VALUES ('G閳坋rd');
COMMIT;

SELECT * FROM test ORDER BY name;

SELECT * FROM test
ORDER BY NLSSORT(name, 'NLS_SORT = XDanish');
REPLACE
See links at page bottom
REVERSE
Reverse REVERSE(<string_or_column>)
SELECT REVERSE('Dan Morgan') FROM dual;

SELECT DUMP('Dan Morgan') FROM dual;
SELECT DUMP(REVERSE('Dan Morgan')) FROM dual;
RPAD
Right Pad RPAD(<string_or_column>, <final_length>, <padding_character>)
SELECT RPAD('Dan Morgan', 25, 'x') FROM dual;
RTRIM
Right Trim RTRIM(<string_or_column>)
SELECT RTRIM('聽聽 Dan Morgan聽聽 ') FROM dual;
SOUNDEX

Returns Character String Constaining The Phonetic Representation Of Another String
Rules:
  • Retain the first letter of the string and remove all other occurrences of the following letters: a, e, h, i, o, u, w, y
  • Assign numbers to the remaining letters (after the first) as
    follows:
    b, f, p, v = 1
    c, g, j, k, q, s, x, z = 2
    d, t = 3
    l = 4
    m, n = 5
    r = 6
  • If two or more letters with the same number were adjacent in the original name (before step 1), or adjacent except for any intervening h and w, then omit all but the first.
  • Return the first four bytes padded with 0.

SOUNDEX(<string_or_column>)

CREATE TABLE test (
name VARCHAR2(15));

INSERT INTO test VALUES ('Smith');
INSERT INTO test VALUES ('Smyth');
INSERT INTO test VALUES ('Smythe');
INSERT INTO test VALUES ('Smither');
INSERT INTO test VALUES ('Smidt');
INSERT INTO test VALUES ('Smick');
INSERT INTO test VALUES ('Smiff');
COMMIT;

SELECT * FROM test;

SELECT *
FROM test
WHERE SOUNDEX(name) = SOUNDEX('SMITH');
SUBSTR
See links at page bottom
TRANSLATE
See links at page bottom
TREAT
Changes The Declared Type Of An Expression TREAT (<expression> AS REF schema.type))聽
SELECT name, TREAT(VALUE(p) AS employee_t).salary SALARY聽
FROM persons p;
TRIM (variations are LTRIM and RTRIM)
Trim Spaces TRIM(<string_or_column>)
SELECT '聽聽 Dan Morgan 聽聽 ' FROM dual;

SELECT TRIM('聽聽 Dan Morgan聽聽 ') FROM dual;
Trim Other Characters TRIM(<character_to_trim> FROM <string_or_column>)
SELECT TRIM('D' FROM 'Dan Morgan') FROM dual;
Trim By CHR value TRIM(<string_or_column>)
SELECT ASCII(SUBSTR('Dan Morgan',1,1)) FROM dual;

SELECT TRIM(CHR(68) FROM 'Dan Morgan') FROM dual;
Vertical Bars
Also known as Pipes <first_string> || <second_string>
SELECT 'Dan' || ' ' || 'Morgan' FROM dual;

with alias

SELECT 'Dan' || ' ' || 'Morgan' NAME FROM dual;
or
SELECT 'Dan' || ' ' || 'Morgan' AS NAME FROM dual;
VSIZE
Byte Size VSIZE(<string_or_column>)
SELECT VSIZE('Dan Morgan') FROM dual;
Related Topics
CASE
DBMS_LOB
Decode
Instring
Miscellaneous Functions
Operators (Built-in)
Regular Expressions
Replace
Substring
Translate
XML Functions


浼兼按嫻佸勾 2006-04-04 09:25 鍙戣〃璇勮
]]>
Trim Function銆怬racle/PLSQL銆戯紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/39079.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Tue, 04 Apr 2006 01:24:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/39079.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/39079.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/39079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/39079.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/39079.html</trackback:ping><description><![CDATA[ <p>In Oracle/PLSQL, the <b>trim</b> function removes all specified characters either from the beginning or the ending of a string.</p> <p>The syntax for the <b>trim</b> function is:</p> <blockquote> <blockquote class="definition"> <p>trim( [ leading | trailing | both聽 [ trim_character ] 聽]聽聽 string1 )</p> </blockquote> </blockquote> <p> <i>leading</i> - remove <i>trim_string</i> from the front of <i>string1.</i></p> <p> <i>trailing</i> - remove <i>trim_string</i> from the end of <i>string1</i>.</p> <p> <i>both</i> - remove <i>trim_string</i> from the front and end of <i>string1</i>.</p> <p>If none of these are chosen (ie: leading, trailing, both), the <b>trim</b> function will remove <i>trim_string</i> from both the front and end of <i>string1</i>.</p> <br /> <p> <i>trim_character</i> is the character that will be removed from <i>string1</i>. If this parameter is omitted, the <b>trim</b> function will remove all leading and trailing spaces from <i>string1</i>.</p> <p> <i>string1</i> is the string to trim.</p> <br /> <p> <u>For example:</u> </p> <blockquote> <table cellspacing="0" cellpadding="3" width="432" border="0"> <tbody> <tr> <td class="function_example" width="232">trim('聽聽 tech聽聽 ')</td> <td class="function_desc">would return 'tech'</td> </tr> <tr> <td class="function_example">trim(' '聽 from聽 '聽聽 tech聽聽 ')</td> <td class="function_desc">would return 'tech'</td> </tr> <tr> <td class="function_example">trim(leading '0' from '000123')</td> <td class="function_desc">would return '123'</td> </tr> <tr> <td class="function_example">trim(trailing '1' from 'Tech1')</td> <td class="function_desc">would return 'Tech'</td> </tr> <tr> <td class="function_example">trim(both '1' from '123Tech111')</td> <td class="function_desc">would return '23Tech'</td> </tr> </tbody> </table> </blockquote> <img src ="http://www.tkk7.com/huhu/aggbug/39079.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-04 09:24 <a href="http://www.tkk7.com/huhu/articles/39079.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>CASE WHEN [Oracle SQL]錛堥摼鎺ワ級http://www.tkk7.com/huhu/articles/38977.html浼兼按嫻佸勾浼兼按嫻佸勾Mon, 03 Apr 2006 09:37:00 GMThttp://www.tkk7.com/huhu/articles/38977.htmlhttp://www.tkk7.com/huhu/comments/38977.htmlhttp://www.tkk7.com/huhu/articles/38977.html#Feedback0http://www.tkk7.com/huhu/comments/commentRss/38977.htmlhttp://www.tkk7.com/huhu/services/trackbacks/38977.htmlhttp://www.adp-gmbh.ch/ora/sql/case_when.html

浼兼按嫻佸勾 2006-04-03 17:37 鍙戣〃璇勮
]]>
RPAD and LPAD in Oracle錛堥摼鎺ワ級http://www.tkk7.com/huhu/articles/38967.html浼兼按嫻佸勾浼兼按嫻佸勾Mon, 03 Apr 2006 09:10:00 GMThttp://www.tkk7.com/huhu/articles/38967.htmlhttp://www.tkk7.com/huhu/comments/38967.htmlhttp://www.tkk7.com/huhu/articles/38967.html#Feedback0http://www.tkk7.com/huhu/comments/commentRss/38967.htmlhttp://www.tkk7.com/huhu/services/trackbacks/38967.htmlhttp://www.adp-gmbh.ch/ora/sql/rpad.html

浼兼按嫻佸勾 2006-04-03 17:10 鍙戣〃璇勮
]]>
START WITH and CONNECT BY in Oracle SQL錛堥摼鎺ワ級http://www.tkk7.com/huhu/articles/38964.html浼兼按嫻佸勾浼兼按嫻佸勾Mon, 03 Apr 2006 09:00:00 GMThttp://www.tkk7.com/huhu/articles/38964.htmlhttp://www.tkk7.com/huhu/comments/38964.htmlhttp://www.tkk7.com/huhu/articles/38964.html#Feedback0http://www.tkk7.com/huhu/comments/commentRss/38964.htmlhttp://www.tkk7.com/huhu/services/trackbacks/38964.html http://www.adp-gmbh.ch/ora/sql/connect_by.html



浼兼按嫻佸勾 2006-04-03 17:00 鍙戣〃璇勮
]]>
oracle trunc()鍑芥暟鐨勭敤娉曪紙杞澆錛?/title><link>http://www.tkk7.com/huhu/articles/38955.html</link><dc:creator>浼兼按嫻佸勾</dc:creator><author>浼兼按嫻佸勾</author><pubDate>Mon, 03 Apr 2006 08:24:00 GMT</pubDate><guid>http://www.tkk7.com/huhu/articles/38955.html</guid><wfw:comment>http://www.tkk7.com/huhu/comments/38955.html</wfw:comment><comments>http://www.tkk7.com/huhu/articles/38955.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/huhu/comments/commentRss/38955.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/huhu/services/trackbacks/38955.html</trackback:ping><description><![CDATA[聽<span id="a0ay8ik" class="bold"><span id="0u00c00" class="smalltxt">TRUNC()鍑芥暟鍒嗕袱縐嶏細<br /><br /></span></span>1.TRUNC(for dates)<br />聽 聽 聽 聽 TRUNC鍑芥暟涓烘寚瀹氬厓绱犺屾埅鍘葷殑鏃ユ湡鍊箋?br />聽 聽 聽 聽 鍏跺叿浣撶殑璇硶鏍煎紡濡備笅錛?br />聽 聽 聽 聽 TRUNC錛坉ate[,fmt]錛?br />聽 聽 聽 聽 鍏朵腑錛?br />聽 聽 聽 聽 date聽 聽 聽 聽 涓涓棩鏈熷?br />聽 聽 聽 聽 fmt聽 聽 聽 聽 聽 聽 聽 聽 鏃ユ湡鏍煎紡錛岃鏃ユ湡灝嗙敱鎸囧畾鐨勫厓绱犳牸寮忔墍鎴幓銆傚拷鐣ュ畠鍒欑敱鏈榪戠殑鏃ユ湡鎴幓<br />聽 聽 聽 聽 涓嬮潰鏄鍑芥暟鐨勪嬌鐢ㄦ儏鍐碉細<br />聽 聽 聽 聽 TRUNC錛圱O_DATE(鈥?4-Nov-1999 08:00 pm鈥?鈥檇d-mon-yyyy hh:mi am鈥?錛?br />聽 聽 聽 聽 聽 聽 聽 聽 =鈥?4-Nov-1999 12:00:00 am鈥?br />聽 聽 聽 聽 TRUNC錛圱O_DATE(鈥?4-Nov-1999 08:37 pm鈥?鈥檇d-mon-yyyy hh:mi am鈥?鈥檋h鈥?錛壜?聽 聽 聽 =鈥?4-Nov-1999 08:00:00 am鈥?br /><br />2.TRUNC(for number)<br />聽 聽 聽 聽 TRUNC鍑芥暟榪斿洖澶勭悊鍚庣殑鏁板鹼紝鍏跺伐浣滄満鍒朵笌ROUND鍑芥暟鏋佷負綾諱技錛屽彧鏄鍑芥暟涓嶅鎸囧畾灝忔暟鍓嶆垨鍚庣殑閮ㄥ垎鍋氱浉搴旇垗鍏ラ夋嫨澶勭悊錛岃岀粺緇熸埅鍘匯?br />聽 聽 聽 聽 鍏跺叿浣撶殑璇硶鏍煎紡濡備笅<br />聽 聽 聽 聽 TRUNC錛坣umber[,decimals]錛?br />聽 聽 聽 聽 鍏朵腑錛?br />聽 聽 聽 聽 number聽 聽 聽 聽 寰呭仛鎴彇澶勭悊鐨勬暟鍊?br />聽 聽 聽 聽 decimals聽 聽 聽 聽 鎸囨槑闇淇濈暀灝忔暟鐐瑰悗闈㈢殑浣嶆暟銆傚彲閫夐」錛屽拷鐣ュ畠鍒欐埅鍘繪墍鏈夌殑灝忔暟閮ㄥ垎<br />聽 聽 聽 聽 涓嬮潰鏄鍑芥暟鐨勪嬌鐢ㄦ儏鍐碉細<br />聽 聽 聽 聽 TRUNC錛?9.985錛?錛?89.98<br />聽 聽 聽 聽 TRUNC錛?9.985錛?89<br />聽 聽 聽 聽 TRUNC錛?9.985錛?1錛?80<br />聽 聽 聽 聽 娉ㄦ剰錛氱浜屼釜鍙傛暟鍙互涓鴻礋鏁幫紝琛ㄧず涓哄皬鏁扮偣宸﹁竟鎸囧畾浣嶆暟鍚庨潰鐨勯儴鍒嗘埅鍘伙紝鍗沖潎浠?璁般?<img src ="http://www.tkk7.com/huhu/aggbug/38955.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/huhu/" target="_blank">浼兼按嫻佸勾</a> 2006-04-03 16:24 <a href="http://www.tkk7.com/huhu/articles/38955.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.tkk7.com/" title="亚洲av成人片在线观看">亚洲av成人片在线观看</a> <div class="friend-links"> </div> </div> </footer> 主站蜘蛛池模板: <a href="http://qestest.com" target="_blank">亚洲人成伊人成综合网久久</a>| <a href="http://9haolc.com" target="_blank">亚洲毛片免费观看</a>| <a href="http://tlyyt.com" target="_blank">无遮挡a级毛片免费看</a>| <a href="http://www-8812.com" target="_blank">免费无码看av的网站</a>| <a href="http://17soco.com" target="_blank">久久无码av亚洲精品色午夜</a>| <a href="http://s8023.com" target="_blank">国产免费爽爽视频免费可以看</a>| <a href="http://www22432.com" target="_blank">亚洲国产无线乱码在线观看</a>| <a href="http://chuoche.com" target="_blank">四虎免费大片aⅴ入口</a>| <a href="http://vcnxa.com" target="_blank">成a人片亚洲日本久久</a>| <a href="http://sao350.com" target="_blank">无码专区一va亚洲v专区在线</a>| <a href="http://pencilinside.com" target="_blank">小说专区亚洲春色校园</a>| <a href="http://wwwav800.com" target="_blank">亚洲高清无码专区视频</a>| <a href="http://ikybh.com" target="_blank">国产免费高清69式视频在线观看</a>| <a href="http://www91v.com" target="_blank">亚洲色欲久久久综合网东京热</a>| <a href="http://wwwse09.com" target="_blank">999zyz**站免费毛片</a>| <a href="http://99999pp.com" target="_blank">亚洲伊人tv综合网色</a>| <a href="http://922eee.com" target="_blank">免费人成网站在线观看10分钟</a>| <a href="http://wenfaka.com" target="_blank">中文字幕无码亚洲欧洲日韩</a>| <a href="http://321fafa.com" target="_blank">免费成人午夜视频</a>| <a href="http://vvihh.com" target="_blank">最近免费中文字幕中文高清</a>| <a href="http://8aa3.com" target="_blank">久久精品国产亚洲av麻豆小说 </a>| <a href="http://mmstom.com" target="_blank">亚洲国产成人无码av在线播放 </a>| <a href="http://jiayila.com" target="_blank">热99re久久精品精品免费</a>| <a href="http://www50884.com" target="_blank">亚洲av无码专区在线观看下载</a>| <a href="http://144446.com" target="_blank">亚洲国产成人久久精品99</a>| <a href="http://ylptt.com" target="_blank">国产中文字幕在线免费观看</a>| <a href="http://huianpawn.com" target="_blank">亚洲理论在线观看</a>| <a href="http://baicaijia666.com" target="_blank">天天摸天天碰成人免费视频</a>| <a href="http://44od.com" target="_blank">色多多www视频在线观看免费</a>| <a href="http://tv787.com" target="_blank">亚洲av伊人久久综合密臀性色</a>| <a href="http://dslygc.com" target="_blank">五月婷婷综合免费</a>| <a href="http://225ck.com" target="_blank">无码免费又爽又高潮喷水的视频 </a>| <a href="http://miya863.com" target="_blank">亚洲AⅤ永久无码精品AA</a>| <a href="http://69xjj.com" target="_blank">成在线人免费无码高潮喷水</a>| <a href="http://4466n.com" target="_blank">久久亚洲精精品中文字幕</a>| <a href="http://8884493.com" target="_blank">女人与禽交视频免费看</a>| <a href="http://34pmpm.com" target="_blank">任你躁在线精品免费</a>| <a href="http://zhaofeiz.com" target="_blank">亚洲精品无码中文久久字幕</a>| <a href="http://770144.com" target="_blank">在线观看午夜亚洲一区</a>| <a href="http://1877808.com" target="_blank">99视频全部免费精品全部四虎</a>| <a href="http://cctv69.com" target="_blank">春意影院午夜爽爽爽免费</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>