DB2 Function Conversion for Sybase ASE Users

Size: px
Start display at page:

Download "DB2 Function Conversion for Sybase ASE Users"

Transcription

1 DB2 Function Conversion for Sybase ASE Users ChangSung KANG, Kitty Lau IMTE Version 1.2 Date: July Page:1 Version: 1.1

2 Document History Version Date Author Comment Authorization /01/2011 ChangSung KANG Initial Draft /06/2011 Kitty Lau Editing and fixing examples /10/2011 Changsung KANG Modify Function table SECTION I Introduction 1.1 Purpose 1.2 Scope 1.3 Oracle compatibility SECTION II Management Summary 2.1 Overview SECTION III Function Types 3.1 Aggregate Functions 3.2 Date Functions 3.3 Mathematical Functions 3.4 Row Aggregate Functions 3.5 String Functions 3.6 Conversion Functions 3.7 Special Functions APPENDIX Table of Content Page:2 Version: 1.1

3 SECTION I Introduction 1.1 Purpose This document is a blueprint for converting Sybase ASE SQL functions to DB2 functions. This document is intended to show which functions in Sybase ASE convert to which functions in DB2 v9.7 FP Scope This document includes the functions in each database and how they equate to each other. 1.3 Oracle compatibility DB2 v9.7 supports Oracle Compatibility which enriches the DB2 user s implementation; therefore this document also involves Oracle style functions. Not only are they one of DB2 s strongest features but they are also part of the new DB2 function set. Page:3 Version: 1.1

4 SECTION II Management Summary 2.1 Overview This document is intended to help DB2 customers and consultants who are planning on porting or supporting an application onto a DB2 platform from a Sybase platform. In particular this document addresses the functions used by both databases and how they equate. The functions will be broken down into the following areas: Aggregate Generate summary values that appear as new columns in the query results. Count is an example of this type of function. Conversion Change expressions from one data type to another and specify new display formats for date/time information. Date Perform computations on 'datetime' and 'smalldatetime' values and their components, obtain date parts. Mathematical Return values commonly needed for operations on mathematical data. Row Aggregate Generate summary values that appear as additional rows in the query results. Compute is an example of this type of function. String Operate on binary data, character strings, and expressions. Special Functions Functions that do not fall into one of the previous categories. Page:4 Version: 1.1

5 SECTION III Function Types 3.1 Aggregate Functions The following is a summary of aggregate functions covered in this section: Sybase DB2 Description AVG Same Finds the average of the values in a column. AVG can only be used on numeric data types. COUNT Same Finds the number of non-null values in a column. When distinct is specified, count finds the number of unique non-null values. COUNT(*) Same Finds the number of rows. MAX Same Finds the maximum value in a column. MIN Same Finds the minimum value in a column SUM Same Finds the sum of all of the values in a column. SUM can only be used on numeric data types. N/A STDDEV Finds the standard deviation of an expression (DB2 specific function) N/A VARIANCE Returns the variance of an expression. VARIANCE can only be used on numeric data types AVG Finds the average of the values in a column or expression. AVG can only be used on numeric data types. AVG ( [ all distinct ] expression ) select WORKDEPT, avg(salary) from EMP group by workdept WORKDEPT A B C D Page:5 Version: 1.1

6 ... * if you format output, use type functions like int(), dec() COUNT cf> dec(avg(salary),9,2) Finds the number of non-null values in a column. When distinct is specified, COUNT finds the number of unique non-null values. COUNT ( [ all distinct ] expression ) COUNT(*) Finds the number of rows that will be returned by the SELECT statement. COUNT ( * ) select WORKDEPT, count(*) from EMPLOYEE group by workdept... WORKDEPT A00 5 B01 1 C MAX Finds the maximum value in a column or expression. MAX ( expression ) select WORKDEPT, max(salary) from EMPLOYEE group by workdept... WORKDEPT A B C Page:6 Version: 1.1

7 3.1.5 MIN Finds the minimum value in a column or expression. MIN ( expression ) SUM Finds the sum of the values in a column or expression. SUM can only be used on numeric data types. SUM ( expression ) select WORKDEPT,sum(salary) from EMPLOYEE group by workdept WORKDEPT A B C STDDEV Finds the standard deviation of an expression. This function is not available within Sybase ASE. STDDEV ( expression ) select WORKDEPT,STDDEV(salary) from EMPLOYEE group by workdept WORKDEPT A B01 0 C * if you format output, use type functions like int(), dec(). cf> dec(avg(salary),9,2) Page:7 Version: 1.1

8 3.1.8 VARIANCE Finds the sum of the variance of an expression. VARIANCE can only be used on numeric data types. This function is not available within Sybase ASE. VARIANCE ( [ all distinct ] expression ) select WORKDEPT,variance(salary) from EMPLOYEE group by workdept WORKDEPT A B01 0 C Page:8 Version: 1.1

9 3.2 Date Functions The following are date manipulation functions from both databases and how they equate: Sybase DB2 Description CONVERT TRUNC, ROUND Used to round or truncate a date value based on the specified format mask. DATEADD DATEDIFF ADD_MONTHS... MONTHS_BET WEEN... Used to return a new date by adding a value to either a day, month or year component. Also can be used to return the first day of the next week. Returns the difference between two dates. DATENAME DAYNAME... Returns the specified part of the date as an integer. Sybase 'datetime' has a higher precision than DB2 'date'. For this reason, it is not always possible to find an equivalent 'format' string in DB2 to match the 'datename' in Sybase. DATEPART DAY, MONTH Returns the specified part of the date as a character string (name). Sybase 'datetime' has a higher precision than DB2 'date'. For this reason, it is not always possible to find an equivalent 'format' string in DB2 to match the 'datepart' in Sybase. GETDATE CURRENT DATE... Returns the system date. LAST_DAY Same Returns the last day in the month of the date value passed. (DB2 specific function) CONVERT Used to round or truncate a date value based on the specified format mask. Convert has other uses that will be covered later in this document. CONVERT ( desired datatype, date-expression, [ format mask ] ) To round a date value: TRUNC, ROUND ( date-expression ) select current timestamp, trunc(current timestamp ) from sysibm.dual Page:9 Version: 1.1

10 3.2.2 DATEADD Used to return a new date by adding a value to either a day, month or year component. Also can be used to return the first day of the next week. To add a day increment to a date value: DATEADD ( day, integer-expression, date-expression ) Where integer-expression is the number of days to get to Monday from the current day. To add a day increment to a date value: date-expression + integer-expression To add a month increment to a date value: ADD_MONTHS ( date-expression, integer-expression ) To add a day increment to a date value: date-expression + integer-expression day(s) select current date, ADD_MONTHS (current date, 2) from sysibm.dual select current date, current date + 2 days from sysibm.dual DATEDIFF Returns the difference between two dates. To determine the number of days between dates: DATEDIFF ( day, date-expression, date-expression ) To determine the number of months between dates: DATEDIFF ( month, date-expression, date-expression ) To determine the number of years between dates: Page:10 Version: 1.1

11 DATEDIFF ( year, date-expression, date-expression ) To determine the number of days between dates: date-expression1 - date-expression2 To determine the number of days between dates: MONTHS_BETWEEN ( date-expression1, date-expression2 ) To determine the number of days between dates: ( date-expression1 - date-expression2 ) / select (current date + 2 days) -( current date) from sysibm.dual select MONTHS_BETWEEN (to_date(' ','yyyy-mm- DD'),current date), current date from sysibm.dual select timestampdiff(256, char(to_date(' ','yyyy-mm-dd') - current date)), current date from sysibm.dual DATENAME Returns the name of the specified part (such as the month "June") of a DATETIME value, as a character string. Sybase 'datetime' has a higher precision than DB2 'date'. For this reason, it is not always possible to find an equivalent 'format' string in DB2 to match the 'datename' in Sybase. To return the string containing a day in a date expression: DATENAME ( day, date-expression ) To return the name of a month: Page:11 Version: 1.1

12 DATENAME( month, date-expression ) To return the string containing a day in a date expression: DAYNAME ( date-expression, (locale-name) ) To return the name of a month: MONTHNAME ( date-expression, (locale-name) ) select dayname(current date),dayname(current date, 'ko_kr'), current date from sysibm.dual Saturday 토요일 select monthname(current date),monthname(current date, 'ko_kr'), date from sysibm.dual current July 7 월 Example: 'TO_CHAR' function which express date format TO_CHAR (TMSTAMP,'Month','en_US') March TO_CHAR (TMSTAMP,'MONTH','en_US') MARCH TO_CHAR (TMSTAMP,'MON','en_US') MAR TO_CHAR (TMSTAMP,'Day','en_US') Friday TO_CHAR (TMSTAMP,'DAY','en_US') FRIDAY TO_CHAR (TMSTAMP,'Dy','en_US') Fri TO_CHAR (TMSTAMP,'Month','de_DE') März TO_CHAR (TMSTAMP,'MONTH','de_DE') MÄRZ TO_CHAR (TMSTAMP,'MON','de_DE') MRZ TO_CHAR (TMSTAMP,'Day','de_DE') Freitag TO_CHAR (TMSTAMP,'DAY','de_DE') FREITAG TO_CHAR (TMSTAMP,'Dy','de_DE') Fr Page:12 Version: 1.1

13 3.2.5 DATEPART Returns an integer value for the specified part of a DATETIME value. Again, since the Sybase 'datetime' has a higher precision than DB2 'date' there may not be an applicable format string between the two databases. To return the integer value of a day in a date expression: DATEPART ( day, date-expression ) To return the integer value of a month in a date expression: DATEPART ( month, date-expression ) To return the integer value of a day in a date expression: DAY ( date-expression ) To return the integer value of a month in a date expression: MONTH ( date-expression ) select day(current date), sysibm.dual month(current date), current date from GETDATE Returns the system date. GETDATE () CURRENT DATE, SYSDATE select current date,current time, sysdate from sysibm.dual /02/ :21: LAST_DAY Returns the last day of the month determined by the passed date expression. This is a DB2 specific function. Page:13 Version: 1.1

14 In Sybase, you must calculate this value by converting a character expression that contains the first day of the next month to a datetime datatype and then use DATEADD with 1 as the integer expression. LAST_DAY ( date-expression ) select last_day(current date), current date from sysibm.dual Page:14 Version: 1.1

15 3.3 Mathematical Functions The following are the mathematical functions from both databases and how they equate: Sybase DB2 Description ABS Same Returns the absolute value of a number. ACOS Same Returns the angle (in radians) whose arc-cosine equals the passed argument. ASIN Same Returns the angle (in radians) whose arc-sine equals the passed argument. ATAN Same Returns the angle (in radians) whose arc-tangent equals the passed argument. ATAN2 Same Returns the angle (in radians) whose tangent equals the division of two passed arguments. CEILING Same Returns the smallest integer that is greater than or equal to the passed numeric argument. CONVERT Same Used to truncate a number to n significant digits. COS Same Returns the cosine of the angle (in radians). COSH Same Returns the hyperbolic cosine of the passed parameter. COT Same Returns the cotangent of then angle (in radians). DEGREES Same Converts radians to degrees. EXP Same Returns the exponential value of the passed parameter. FLOOR Same Returns the largest integer that is less than or equal to the passed numeric argument. LOG LN Returns the natural logarithm of the passed parameter. LOG10 Same Returns the base 10 logarithm of the passed argument. % MOD Returns the remainder or modulus of the division of two numeric arguments. PI N/A Returns the value of pi ( ). POWER Same Returns the value of one numeric argument raised to the power of a second numeric argument. RADIANS Same Converts degrees to radians. RAND Same Returns a random number between 0 and 1. ROUND Same Rounds a number to a specified precision. SIGN Same Returns 1 if a passed number is less than zero, 0 if equal to zero, or 1 if positive. Page:15 Version: 1.1

16 Sybase DB2 Description SIN Same Returns the sine of the passed angle (in radians). SINH Same Returns the hyperbolic sine of the passed angle (in radians). SQRT Same Returns the square root of a number. TAN Same Returns the tangent of the passed angle (in radians). TANH Same Returns the hyperbolic tangent of the passed angle (in radians) ABS Returns the absolute value of a number-expression. ABS ( number-expression ) ACOS Returns the arc-cosine of a number expression in radians. ACOS ( number-expression ) ASIN Returns the arc-sine of a number expression in radians. ASIN ( number-expression ) ATAN Returns the arc-tangent of a number expression in radians. ATAN ( number-expression ) ATAN2 Returns the angle (in radians) whose tangent equals the division of two passed arguments. ATAN2 ( number-expression1, number-expression2 ) Page:16 Version: 1.1

17 3.3.6 CEILING Returns the ceiling (smallest integer not less than) of a numeric expression. CEILING ( number-expression ) CEILING / CEIL ( number-expression ) COS Returns the cosine of a number expression in radians. COS ( number-expression ) COSH Returns the hyperbolic cosine of a number expression in radians This function is not implemented in Sybase ASE. COSH ( number-expression ) CONVERT Truncate a number expression to a specified number of decimal places. CONVERT ( datatype, number-expression * POWER( 10, n ), format-mask of desired number of digits ) / POWER( 10, n ) TRUNC ( number-expression, integer-expression (# of decimal places) ) COT Returns the cotangent of a number expression in radians. COT ( number-expression ) Page:17 Version: 1.1

18 DEGREES Converts number expression from radians to degrees. DEGREES ( number-expression ) EXP Returns the exponential value of a number expression. EXP ( number-expression ) FLOOR Returns the floor (largest integer not greater than) of numeric expression. FLOOR ( number-expression ) LOG Returns the natural logarithm of a number expression. LOG ( number-expression ) LN ( number-expression ) LOG10 Returns the base 10 logarithm of the passed argument. LOG10 ( number-expression ) % Returns the remainder when dividend is divided by divisor. Division involving a negative dividend will give a negative or zero result. Page:18 Version: 1.1

19 number-expression (dividend) % number-expression (divisor) MOD ( number-expression (dividend), number-expression (divisor) ) PI Returns the arithmetic value of pi ( ). PI () This function is not available in DB POWER Returns the value of one numeric argument raised to the power of a second numeric argument. POWER ( number-expression, number-expression (magnitude) ) RADIANS Converts degrees to radians. RADIANS ( number-expression ) RAND Returns a random number in the interval 0 to 1, using a number-expression as an optional seed. RAND ( number-expression ) ROUND Rounds numeric-expression to integer-expression places after the decimal point. A positive integer determines the number of significant digits to the right of the decimal point; a negative integer, the number of significant digits to the left of the decimal point. ROUND ( number-expression, integer-expression ) Page:19 Version: 1.1

20 SIGN Returns the sign of a number expression. SIGN ( number-expression ) SIN Returns the sine of a numeric expression, expressed in radians SIN ( number-expression ) SINH Returns the hyperbolic sine of a numeric expression, expressed in radians This function is not available in Sybase ASE. SINH ( number-expression ) SQRT Returns the square root of a numeric expression. SQRT ( number-expression ) TAN Returns the tangent of a numeric expression, expressed in radians TAN ( number-expression ) TANH Returns the hyperbolic tangent of a numeric expression, expressed in radians Not implemented in Sybase ASE. Page:20 Version: 1.1

21 TANH ( number-expression ) Page:21 Version: 1.1

22 3.4 Row Aggregate Functions Row aggregate functions are located at the end of a select statement and the results appear as additional rows in the query. The following are the row aggregate functions in both databases and how they equate: Sybase DB2 Description AVG Same Finds the average of the values in a column. AVG can only be used on numeric data types. COUNT Same Finds the number of non-null values in a column. When distinct is specified, count finds the number of unique non-null values. MAX Same Finds the maximum value in a column. MIN Same Finds the minimum value in a column SUM Same Finds the sum of all of the values in a column. SUM can only be used on numeric data types AVG This function is used to find the average of the values in a column or expression. AVG can only be used on numeric data types. AVG ( [ all distinct ] expression ) COUNT Finds the number of non-null values in a column. When distinct is specified, count finds the number of unique non-null values. COUNT ( [ all distinct ] expression ) MAX Finds the maximum value in a column or expression. MAX ( expression ) MIN Finds the minimum value in a column or expression. Page:22 Version: 1.1

23 3.4.5 SUM MIN ( expression ) Finds the sum of the values in a column or expression. Sum can only be used on numeric data types. SUM ( expression ) Page:23 Version: 1.1

24 3.5 String Functions The following are the string functions in both databases and how they equate: Sybase DB2 Description ASCII Same Returns the integer ASCII value of the first byte in a string expression, or 0 for the empty string. CHAR Same Returns the character with the ASCII value for a given numeric expression. CHAR_LENGT H LENGTH Computes the length allocated to a string expression, giving the result in number of characters. CHARINDEX INSTR Returns the position where the string-to-search first occurs in the string-expression. CONCAT Same Returns char1 concatenated with char2. DATALENGTH LENGTH Computes the length allocated to an expression, giving the result in bytes. DIFFERENCE SOUNDEX Returns the numeric difference of the SOUNDEX values of two strings. INITCAP INITCAP Returns a string with the first letter of each word in uppercase. ISNULL NVL If the value of the variable is NULL, the new value is returned LEFT SUBSTR Returns the leftmost integer-expression characters from a string expression. LOWER LOWER Converts all characters in a string expression into all lowercase. N/A LPAD Returns source string expression left padded to specified length with the sequence of characters in a second string expression. LTRIM Same Truncates leading spaces from the left end of specified string expression. PATINDEX INSTR ( Returns the position of the pattern in the column value. The pattern can have wild characters. This function also works on TEXT and BINARY data types. REPLICATE REPEAT Produces a string with a character expression repeated a specified amount of times. REVERSE N/A Reverses the passed string expression. RIGHT Same Returns the right-most integer-expression characters from a string-expression. Page:24 Version: 1.1

25 Sybase DB2 Description N/A RPAD Returns source string expression right padded to specified length with the sequence of characters in char_exp2. RTRIM Same Truncates the trailing spaces from the right end of a string expression. SOUNDEX Same This function allows the user to compare words that are spelled differently. SPACE N/A This function returns a string with the indicated number of single-byte spaces. STR TO_CHAR Returns a character representation of an approximate number STUFF N/A Deletes length characters from a base string expression at a starting point for a specified length then inserts the desired string expression into the base string expression at the starting point. SUBSTRING SUBSTR Returns part of a character starting from a given starting point for a specified length. N/A TRANSLA TE Returns a string expression with all occurrences of each character in a from string expression replaced by its corresponding character in a to string expression. Characters in the base string expression not found in the from string expression are not replaced. UPPER Same Converts all characters in a string expression to uppercase ASCII Returns the integer ASCII value of the first byte in a string expression, or 0 for the empty string. ASCII ( string-expression ) CHAR Converts the decimal code to its corresponding ASCII character. CHAR ( integer-expression ) Page:25 Version: 1.1

26 3.5.3 CHAR_LENGTH Computes the length allocated to a string expression, giving the result in number of characters. CHAR_LENGTH LENGTH ( string-expression) select length('changsung') from sysibm.dual CHARINDEX Returns the position where the string-to-search first occurs in the string-expression. CHARINDEX ( string-expression, string-to-search ) INSTR ( string-expression, string-to-search ) select INSTR('changsung','s') from sysibm.dual CONCAT Concatenates two string expressions. string-expression-1 + string-expression-2 CONCAT ( string-expression-1, string-expression-2 ) select concat('kang ', 'changsung'), 'KANG ' 'changsung' from sysibm.dual Page:26 Version: 1.1

27 KANG changsung KANG changsung DATALENGTH Computes the length allocated to a string expression, giving the result in bytes. DATALENGTH ( string-expression ) LENGTH ( string-expression ) DIFFERENCE Returns the numeric difference of the SOUNDEX values of the two strings. DIFFERENCE ( string-expression1, string-expression2 ) SOUNDEX( string-expression1 ) SOUNDEX( string-expression2 ) INITCAP Returns a string with the first letter of each word in uppercase. This must be performed by programmatic means by using Transact- SQL functions to parse the given string and convert the beginning of each word to uppercase. INITCAP ( string-expression ) select initcap ( 'changsung' ) from sysibm.dual Changsung Page:27 Version: 1.1

28 3.5.9 ISNULL If the value of the variable is NULL, the new value is returned. ISNULL ( data-value, new-value ) NVL ( data-value, new-value ) select nvl ( null, 0 ), nvl ( 1, 0 ) from sysibm.dual LEFT Returns the leftmost integer-expression characters from a string expression. LEFT ( string-expression, integer-expression ) SUBSTR ( string-expression, 1, integer-length ) select left ('chang',2) from sysibm.dual ch LOWER Converts all characters in a string expression to lowercase. LOWER ( string-expression ) LPAD Returns string-expression-1 left padded to a specified length with repeating characters in string-expression-2. REPLICATE( string-expression-2, (integer-expression-datalength(stringexpression-1)) ) + string-expression-1 Page:28 Version: 1.1

29 LPAD ( string-expression-1, integer-expression, string-expression-2 ) SELECT LPAD(FIRSTNME,15,'.' ) from EMPLOYEE CHRISTINE...MICHAEL...SALLY...JOHN LTRIM Truncates leading spaces from a string expression. LTRIM ( string-expression ) PATINDEX Returns the position of the pattern in a string expression. The pattern can have wildcard characters. This function also works on TEXT and BINARY data types. PATINDEX ( pattern-string, string-to-search ) (Does NOT accept wildcard characters) INSTR ( string-to-find, string-to-search ) SELECT INSTR(FIRSTNME,'A'), FIRSTNME from EMPLOYEE... 1 FIRSTNME CHRISTINE 5 MICHAEL 2 SALLY REPLACE Returns a string with every occurrence of a search-string-expression replaced with a replace-string-expression. Use a combination of PATINDEX() and SUBSTR() Page:29 Version: 1.1

30 REPLACE ( string-expression, search-string, replace-string ) SELECT replace (FIRSTNME,'C', '$'), FIRSTNME from EMPLOYEE 1 FIRSTNME $HRISTINE CHRISTINE MI$HAEL MICHAEL REPLICATE Produces a string with a specified character repeated a desired number of times. REPLICATE ( character, number-expression ) REPEAT ( string-expression, integer-expression) select repeat('chang ',3) from sysibm.dual chang chang chang REVERSE Reverses the characters in a string expression. REVERSE ( string-expression ) Use User Defined Function RIGHT Returns the right-most integer-expression characters from a string-expression. RIGHT ( string-expression, integer-expression ) select right ('chang', 2) from sysibm.dual Page:30 Version: 1.1

31 ng RPAD Returns string-expression-1 right padded to a specified length with repeating characters in string-expression-2. string-expression-1 + REPLICATE( string-expression-2, (integer-expression- DATALENGTH(string-expression-1)) ) RPAD ( string-expression-1, integer-expression, string-expression-2 ) SELECT RPAD (FIRSTNME,15, '$'), FIRSTNME from EMPLOYEE... 1 FIRSTNME CHRISTINE$$$$$$ CHRISTINE MICHAEL$$$$$$$$ MICHAEL SALLY$$$$$$$$$$ SALLY JOHN$$$$$$$$$$$ JOHN RTRIM Truncates the trailing spaces from the right end of a string expression. RTRIM ( string-expression ) select rtrim ('chang ') sung from sysibm.dual changsung SOUNDEX Returns a number representing the sound of a string expression. Page:31 Version: 1.1

32 SOUNDEX ( string-expression ) SELECT EMPNO, LASTNAME FROM EMPLOYEE WHERE SOUNDEX(LASTNAME) = SOUNDEX('Loucesy') EMPNO LASTNAME LUCCHESSI SPACE This function returns a string of a specified number of single-byte spaces. SPACE ( integer-expression ) The DB2 REPEAT() and LPAD/RPAD() functions can be used to duplicate the functionality of SPACE() in Sybase ASE. select chang repeat(' ', 10) sung from sysibm.dual chang sung STR Returns a string representing the passed numeric argument. STR ( number-expression, integer-expression (length), integer-expression (decimals) ) TO_CHAR ( number-expression, format-string ) SELECT lastname, TO_CHAR(salary, '9999,99') SALARY from EMPLOYEE LASTNAME SALARY HAAS 1527,50 THOMPSON 942,50 KWAN 982,50 Page:32 Version: 1.1

33 ... GEYER 801,75 STERN 722,50 Example: 'TO_CHAR' function which express number type format Function invocation Result TO_CHAR(POSNUM) ' ' TO_CHAR (NEGNUM) ' ' TO_CHAR (POSNUM,' ') ' ' TO_CHAR (NEGNUM,' ') ' ' TO_CHAR (POSNUM,' ') ' ' TO_CHAR (NEGNUM,' ') ' ' TO_CHAR (POSNUM,' ') ' ' TO_CHAR (NEGNUM,' ') ' ' TO_CHAR (POSNUM,' MI') ' ' TO_CHAR (NEGNUM,' MI') ' ' TO_CHAR (POSNUM,'S ') ' ' TO_CHAR (NEGNUM,'S ') ' ' TO_CHAR (POSNUM,' PR') ' ' TO_CHAR (NEGNUM,' PR') '< >' TO_CHAR (POSNUM,'S$9,999.99') '+$1,234.56' STUFF Deletes characters from string-expression-1 at a specified starting position for a desired length then inserts string-expression-2 into string-expression-1 at the starting position. STUFF ( string-expression-1, integer-expression (start), integer-expression (length), string-expression-2 ) This operation can be simulated by using a combination of the LENGTH(), SUBSTR(), and CONCAT() functions [Sybase] SELECT STUFF ('chang', 1, 3, 'KKK') column KKKng [DB2] select FIRSTNME, 'KKK' (substr(firstnme,4, length(firstnme) )) FROM EMPLOYEE FIRSTNME Page:33 Version: 1.1

34 .. CHRISTINE MICHAEL SALLY JOHN IRVING KKKISTINE KKKHAEL KKKLY KKKN KKKING SUBSTRING Returns part of a string expression starting at a specified starting position for a desired length of characters. SUBSTRING ( string-expression, integer-start, integer-length ) SUBSTR ( string-expression, integer-start, integer-length ) To specify the desired result length in bytes: SUBSTRB ( string-expression, integer-start, integer-length ) select substr(firstnme,1, 4) FROM EMPLOYEE CHRI MICH SALL JOHN TRANSLATE Returns a string expression with all occurrences of each character in a from string expression replaced by its corresponding character in a to string expression. Characters in the base string expression not found in the from string expression are not replaced. Use a combination of PATINDEX() and SUBSTRING() TRANSLATE ( string-expression, to-string-expression, from-string-expression ) select translate ('Hanauma Bay', 'r', 'Bu') from sysibm.dual Page:34 Version: 1.1

35 Hanama ray UPPER Converts all characters in a string expression to uppercase. UPPER ( string-expression ) Page:35 Version: 1.1

36 3.6 Conversion Functions The following are the conversion functions in both databases and how they equate: Sybase DB2 Description convert (datatype, expression, [format]) convert ( datatype, expression, [format]) convert ( datatype, expression, [format]) convert ( datatype, expression, [format]) str (approx_number, length, decimal) hextoint (hexstring) inttohex (integer) convert (char, dest_char_set, source_char_set) to_char (data, format) to_date (char, format) to_number (char, format) to_char (approx_num, format) Converts a character string from one character set to another. Converts data to character datatype based on format. Converts char to timestamp datatype based on format. Converts a char to a number based on format. Returns a character representation of the approx_num. Returns a platform independent integer equivalent of a hexadecimal sting. Returns a platform independent hexadecimal equivalent. Page:36 Version: 1.1

37 3.7 Special Functions DECODE DB2 has not only ANSI SQL 'CASE' statement not also a non-ansi SQL extension called DECODE. DECODE function evaluates a field and returns it in as a set of possible values. The DECODE function syntax is a follows: DECODE (expr, search, result, search2, result2,..., default) The expression is evaluated and if its value equals one of the search values it is replaced with the result value. Otherwise it is replaced with the default value. In Sybase a SELECT statement may appear anywhere that a column specification appears. For the following SALES table: year qtr amount In Sybase: If you want to select the year, q1 amount, q2 amount, q3 amount and q4 as a row. Sybase 4.X accepts the following query: SELECT distinct year, FROM sales s; q1 = (SELECT amt FROM sales WHERE qtr=1 AND year = s.year), q2 = (SELECT amt FROM sales WHERE qtr=2 AND year = s.year), q3 = (SELECT amt FROM sales WHERE qtr=3 AND year = s.year), q4 = (SELECT amt FROM sales WHERE qtr=4 AND year = s.year) Page:37 Version: 1.1

38 In DB2: In this example, replace the SELECT statement with DECODE. Then the query would function as normal. The DECODE function is much faster than Sybase subqueries. Translate the above query to the following for DB2: SELECT year, DECODE( qtr, 1, amt, 0 ) q1, DECODE( qtr, 2, amt, 0 ) q2, DECODES qtr, 3, amt, 0 ) q3, DECODE( qtr, 4, amt, 0 ) q4 FROM sales s; Page:38 Version: 1.1

39 APPENDIX [Table] DB2 Sample Database Schema Page:39 Version: 1.1

40 [Sample UDFs for Migration] [Porting to DB2 from Sybase Adaptive Server or Microsoft SQL Server 2000] [Summary] Mapping functions Sybase vs DB2 Function Mapping Information: Aggregate NO SYBFUNC DB2FUNC REMARKS CATEGORY 1 AVG AVG NO CHANGE AGGREGATE 2 COUNT COUNT NO CHANGE AGGREGATE 3 MAX MAX NO CHANGE AGGREGATE 4 MIN MIN NO CHANGE AGGREGATE 5 SUM SUM NO CHANGE AGGREGATE Sybase vs DB2 Function Mapping Information: Conversion NO SYBFUNC DB2FUNC REMARKS CATEGORY 6 HEXTOINT - NO EQUIVALENT CONVERSION 7 INTTOHEX HEX PARTIALLY EQUIVALENT CONVERSION 8 ONVERT PC CHANGE CONVERSION Page:40 Version: 1.1

41 Sybase vs DB2 Function Mapping Information: Date NO SYBFUNC DB2FUNC REMARKS CATEGORY 9 DATEADD - DATE ARITHMETIC DATE 10 DATEDIFF - DATE ARITHMETIC DATE 11 DATENAME - DATE ARITHMETIC DATE 12 DATEPART - DATE ARITHMETIC DATE 13 GETDATE CURRENT TIMESTAMP CHANGE DATE Sybase vs DB2 Function Mapping Information: Mate NO SYBFUNC DB2FUNC REMARKS CATEGORY 14 ABS ABS NO CHANGE MATH 15 ACOS ACOS NO CHANGE MATH 16 CEILING CEILING NO CHANGE MATH 17 COS COS NO CHANGE MATH 18 COT COT NO CHANGE MATH 19 DEGREES DEGREES NO CHANGE MATH 20 EXP EXP NO CHANGE MATH 21 FLOOR FLOOR NO CHANGE MATH 22 LOG LOG NO CHANGE MATH 23 LOG10 LOG10 NO CHANGE MATH 24 PI - NO EQUIVALENT MATH 25 POWER POWER NO CHANGE MATH 26 RADIANS RADIANS NO CHANGE MATH Page:41 Version: 1.1

42 27 RAND RAND NO CHANGE MATH 28 ROUND ROUND NO CHANGE MATH 29 SIGN SIGN NO CHANGE MATH 30 SIN SIN NO CHANGE MATH 31 SQRT SQRT NO CHANGE MATH 32 SQUARE - NO EQUIVALENT MATH 33 TAN TAN NO CHANGE MATH Sybase vs DB2 Function Mapping Information: Security NO SYBFUNC DB2FUNC REMARKS CATEGORY 34 IS_SEC_SERVICE_ON - NO EQUIVALENT SECURITY 35 MUT_EXCL_ROLES - NO EQUIVALENT SECURITY 36 PROC_ROLE - NO EQUIVALENT SECURITY 37 ROLE_CONTAIN - NO EQUIVALENT SECURITY 38 ROLE_ID - NO EQUIVALENT SECURITY 39 ROLE_NAME - NO EQUIVALENT SECURITY 40 SHOW_ROLE - NO EQUIVALENT SECURITY 41 SHOW_SEC_SERVICES - NO EQUIVALENT SECURITY Sybase vs DB2 Function Mapping Information: String NO SYBFUNC DB2FUNC REMARKS CATEGORY 42 ASCII ASCII NO CHANGE STRING 43 CHAR CHR CHANGE STRING Page:42 Version: 1.1

43 44 CHARINDEX POSSTROR LOCATE CHANGE STRING 45 CHAR_LENGTH LENGTH NO CHANGE STRING 46 DIFFERENCE DIFFERENCE NO CHANGE STRING 47 LOWER LOWER NO CHANGE STRING 48 LTRIM LTRIM NO CHANGE STRING 49 PATINDEX POSSTR CHANGE STRING 50 REPLICATE REPEAT CHANGE STRING 51 REVERSE - NO EQUIVALENT STRING 52 RIGHT RIGHT NO CHANGE STRING 53 RTRIM RTRIM NO CHANGE STRING 54 SOUNDEX SOUNDEX NO CHANGE STRING 55 SPACE SPACE NO CHANGE STRING 56 STR CHAR PARTLY EQUIVALENT STRING 57 STUFF INSERT CHANGE STRING 58 SUBSTRING SUBSTR CHANGE STRING Sybase vs DB2 Function Mapping Information: System NO SYBFUNC DB2FUNC REMARKS CATEGORY 59 COL_LENGTH - NO EQUIVALENT SYSTEM 60 COL_SIZE - NO EQUIVALENT SYSTEM 61 CURUNRESERVEDPGS - NO EQUIVALENT SYSTEM 62 DATALENGTH LENGTH CHANGE SYSTEM 63 DATA_PGS - NO EQUIVALENT SYSTEM Page:43 Version: 1.1

44 64 DB_ID - NO EQUIVALENT SYSTEM 65 DB_NAME - NO EQUIVALENT SYSTEM 66 HOST_ID - NO EQUIVALENT SYSTEM 67 HOST_NAME - NO EQUIVALENT SYSTEM 68 ICT_ADMIN - NO EQUIVALENT SYSTEM 69 INDEX_COL - NO EQUIVQLENT SYSTEM 70 ISNULL COALESCE NO CHANGE SYSTEM 71 OBJECT_ID - NO EQUIVALENT SYSTEM 72 OBJECT_NAME - NO EQUIVALENT SYSTEM 73 PTN_DATA_PGS - NO EQUIVALENT SYSTEM 74 RESERVED_PGS - NO EQUIVALENT SYSTEM 75 ROWCNT - NO EQUIVALENT SYSTEM 76 SUSER_ID - NO EQUIVALENT SYSTEM 77 SUSER_NAME CURRENT USER CHANGE SYSTEM 78 TSEQUAL - NO EQUIVALENT SYSTEM 79 USED_PGS - NO EQUIVALENT SYSTEM 80 USER CURRENT USER CHANGE SYSTEM 81 USER_ID - NO EQUIVALENT SYSTEM 82 USER_NAME CURRENT USER CHANGE SYSTEM 83 VALID_NAME - NO EQUIVALENT SYSTEM 84 VALID_USER - NO EQUIVALENT SYSTEM Page:44 Version: 1.1

45 Sybase vs DB2 Function Mapping Information: Text SYBFUNC DB2FUNC REMARKS CATEGORY TEXTPTR - NO EQUIVALENT TEXT TEXTVALID - NO EQUIVALENT TEXT * DB2 LOB-locator replaces with this feature. Page:45 Version: 1.1

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 3 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA

More information

This course is aimed at those who need to extract information from a relational database system.

This course is aimed at those who need to extract information from a relational database system. (SQL) SQL Server Database Querying Course Description: This course is aimed at those who need to extract information from a relational database system. Although it provides an overview of relational database

More information

SQL FUNCTIONS. Prepared By:Dr. Vipul Vekariya.

SQL FUNCTIONS. Prepared By:Dr. Vipul Vekariya. SQL FUNCTIONS Prepared By:Dr. Vipul Vekariya. SQL FUNCTIONS Definition of Function Types of SQL Function Numeric Function String Function Conversion Function Date Function SQL Function Sub program of SQL

More information

UNIT III INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL)

UNIT III INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) UNIT III INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) 3.1Data types 3.2Database language. Data Definition Language: CREATE,ALTER,TRUNCATE, DROP 3.3 Database language. Data Manipulation Language: INSERT,SELECT,UPDATE,DELETE

More information

Built-in SQL Functions. Chapter 5

Built-in SQL Functions. Chapter 5 Built-in SQL Functions Chapter 5 Type of Functions Character Functions returning character values returning numeric values Numeric Functions Date Functions Conversion Functions Group Functions Error Reporting

More information

Topics Fundamentals of PL/SQL, Integration with PROIV SuperLayer and use within Glovia

Topics Fundamentals of PL/SQL, Integration with PROIV SuperLayer and use within Glovia Topics Fundamentals of PL/SQL, Integration with PROIV SuperLayer and use within Glovia 1. Creating a Database Alias 2. Introduction to SQL Relational Database Concept Definition of Relational Database

More information

Single row numeric functions

Single row numeric functions Single row numeric functions Oracle provides a lot of standard numeric functions for single rows. Here is a list of all the single row numeric functions (in version 10.2). Function Description ABS(n) ABS

More information

SQL. - single row functions - Database Design ( 데이터베이스설계 ) JUNG, Ki-Hyun ( 정기현 )

SQL. - single row functions - Database Design ( 데이터베이스설계 ) JUNG, Ki-Hyun ( 정기현 ) SQL Database Design ( 데이터베이스설계 ) - single row functions - JUNG, Ki-Hyun ( 정기현 ) 1 SQL Functions Input Function Output Function performs action that defined already before execution 2 Two Types of SQL Functions

More information

Course Outline and Objectives: Database Programming with SQL

Course Outline and Objectives: Database Programming with SQL Introduction to Computer Science and Business Course Outline and Objectives: Database Programming with SQL This is the second portion of the Database Design and Programming with SQL course. In this portion,

More information

Writing PL/SQL Executable Statements. Copyright 2007, Oracle. All rights reserved.

Writing PL/SQL Executable Statements. Copyright 2007, Oracle. All rights reserved. What Will I Learn? In this lesson, you will learn to: Construct accurate variable assignment statements in PL/SQL Construct accurate statements using built-in SQL functions in PL/SQL Differentiate between

More information

Introduction to Computer Science and Business

Introduction to Computer Science and Business Introduction to Computer Science and Business This is the second portion of the Database Design and Programming with SQL course. In this portion, students implement their database design by creating a

More information

What are temporary tables? When are they useful?

What are temporary tables? When are they useful? What are temporary tables? When are they useful? Temporary tables exists solely for a particular session, or whose data persists for the duration of the transaction. The temporary tables are generally

More information

CS Week 10 - Page 1

CS Week 10 - Page 1 CS 425 Week 10 Reading: 1. Silberschatz, Krth & Sudarshan, Chapter 3.2 3.5 Objectives: 1. T learn mre abut SQL Functins used in queries. Cncepts: 1. SQL Functins Outline: SQL Functins Single rw functins

More information

Senturus Analytics Connector. User Guide Cognos to Tableau Senturus, Inc. Page 1

Senturus Analytics Connector. User Guide Cognos to Tableau Senturus, Inc. Page 1 Senturus Analytics Connector User Guide Cognos to Tableau 2019-2019 Senturus, Inc. Page 1 Overview This guide describes how the Senturus Analytics Connector is used from Tableau after it has been configured.

More information

Senturus Analytics Connector. User Guide Cognos to Power BI Senturus, Inc. Page 1

Senturus Analytics Connector. User Guide Cognos to Power BI Senturus, Inc. Page 1 Senturus Analytics Connector User Guide Cognos to Power BI 2019-2019 Senturus, Inc. Page 1 Overview This guide describes how the Senturus Analytics Connector is used from Power BI after it has been configured.

More information

Topics - System Administration for Glovia

Topics - System Administration for Glovia Topics - System Administration for Glovia 1. Network Architecture Sample Network 2. glovia.com Technology Architecture Application Server Database Server Web Server 3. Operating System Architecture High

More information

COPYRIGHTED MATERIAL. Contents. Chapter 2: Functions: Concept and Architecture 13. Acknowledgments Introduction

COPYRIGHTED MATERIAL. Contents. Chapter 2: Functions: Concept and Architecture 13. Acknowledgments Introduction Acknowledgments Introduction ix xxxv Chapter 1: Exploring Popular SQL Implementations 1 Introduction to SQL 1 Understanding the SQL Standard 2 Overview of Vendor Implementations of SQL 2 Oracle 3 IBM DB2

More information

Introduction to Functions and Variables

Introduction to Functions and Variables Introduction to Functions and Variables Functions are a way to add additional elements into your OBI Report. They enable you to manipulate data, perform computations and comparisons, and get system information.

More information

GIFT Department of Computing Science. [Spring 2016] CS-217: Database Systems. Lab-3 Manual. Single Row Functions in SQL

GIFT Department of Computing Science. [Spring 2016] CS-217: Database Systems. Lab-3 Manual. Single Row Functions in SQL GIFT Department of Computing Science [Spring 2016] CS-217: Database Systems Lab-3 Manual Single Row Functions in SQL V3.0 4/26/2016 Introduction to Lab-3 Functions make the basic query block more powerful,

More information

SQL Structured Query Language (1/2)

SQL Structured Query Language (1/2) Oracle Tutorials SQL Structured Query Language (1/2) Giacomo Govi IT/ADC Overview Goal: Learn the basic for interacting with a RDBMS Outline SQL generalities Available statements Restricting, Sorting and

More information

COPYRIGHTED MATERIAL. Contents. Chapter 1: Introducing T-SQL and Data Management Systems 1. Chapter 2: SQL Server Fundamentals 23.

COPYRIGHTED MATERIAL. Contents. Chapter 1: Introducing T-SQL and Data Management Systems 1. Chapter 2: SQL Server Fundamentals 23. Introduction Chapter 1: Introducing T-SQL and Data Management Systems 1 T-SQL Language 1 Programming Language or Query Language? 2 What s New in SQL Server 2008 3 Database Management Systems 4 SQL Server

More information

MYSQL NUMERIC FUNCTIONS

MYSQL NUMERIC FUNCTIONS MYSQL NUMERIC FUNCTIONS http://www.tutorialspoint.com/mysql/mysql-numeric-functions.htm Copyright tutorialspoint.com MySQL numeric functions are used primarily for numeric manipulation and/or mathematical

More information

Oracle Database 12c SQL Fundamentals

Oracle Database 12c SQL Fundamentals Course Overview This course takes a unique approach to SQL training in that it incorporates data modeling theory, relational database theory, graphical depictions of theoretical concepts and numerous examples

More information

How to Configure Pushdown Optimization for an Amazon Redshift Task Using an ODBC Connection

How to Configure Pushdown Optimization for an Amazon Redshift Task Using an ODBC Connection How to Configure Pushdown Optimization for an Amazon Redshift Task Using an ODBC Connection Copyright Informatica LLC 2017. Informatica, the Informatica logo, and Informatica Cloud are trademarks or registered

More information

Phụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number.

Phụ lục 2. Bởi: Khoa CNTT ĐHSP KT Hưng Yên. Returns the absolute value of a number. Phụ lục 2 Bởi: Khoa CNTT ĐHSP KT Hưng Yên Language Element Abs Function Array Function Asc Function Atn Function CBool Function CByte Function CCur Function CDate Function CDbl Function Chr Function CInt

More information

Chapter-14 SQL COMMANDS

Chapter-14 SQL COMMANDS Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language

More information

SQL Functions (Single-Row, Aggregate)

SQL Functions (Single-Row, Aggregate) Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Database Lab (ECOM 4113) Lab 4 SQL Functions (Single-Row, Aggregate) Eng. Ibraheem Lubbad Part one: Single-Row Functions:

More information

Arithmetic and Logic Blocks

Arithmetic and Logic Blocks Arithmetic and Logic Blocks The Addition Block The block performs addition and subtractions on its inputs. This block can add or subtract scalar, vector, or matrix inputs. We can specify the operation

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

Built-in Types of Data

Built-in Types of Data Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),

More information

@vmahawar. Agenda Topics Quiz Useful Links

@vmahawar. Agenda Topics Quiz Useful Links @vmahawar Agenda Topics Quiz Useful Links Agenda Introduction Stakeholders, data classification, Rows/Columns DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE CONSTRAINTS, DATA TYPES DML Data

More information

arc tangent, 26 ASIN, 22t, 25 ATAN, 22t, 26 ATAN2, 22t, 26 ATANH, 22t, 26 AVG, 18t

arc tangent, 26 ASIN, 22t, 25 ATAN, 22t, 26 ATAN2, 22t, 26 ATANH, 22t, 26 AVG, 18t A ABS, 22t, 24 Access. See Microsoft Access ACOS, 22t, 24 Active Server Pages (ASP), 2, 153-154,, ADO/ODBC and, 140-142, -, ActiveX Data Objects. See ADO ADO/ODBC, 18, 132-142, 156 Active Server Pages

More information

Insert Into Customer1 (ID, CustomerName, City, Country) Values(103, 'Marwa','Baghdad','Iraq')

Insert Into Customer1 (ID, CustomerName, City, Country) Values(103, 'Marwa','Baghdad','Iraq') Insert Into Customer1 (ID, CustomerName, City, Country) Values(103, 'Marwa','Baghdad','Iraq') Notes: 1. To View the list of all databases use the following command: Select * (or name) From Sys.databases

More information

After completing this unit, you should be able to: Define the terms

After completing this unit, you should be able to: Define the terms Introduction Copyright IBM Corporation 2007 Course materials may not be reproduced in whole or in part without the prior written permission of IBM. 4.0.3 3.3.1 Unit Objectives After completing this unit,

More information

How to Design Programs Languages

How to Design Programs Languages How to Design Programs Languages Version 4.1 August 12, 2008 The languages documented in this manual are provided by DrScheme to be used with the How to Design Programs book. 1 Contents 1 Beginning Student

More information

1001ICT Introduction To Programming Lecture Notes

1001ICT Introduction To Programming Lecture Notes 1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 1, 2015 1 M Environment console M.1 Purpose This environment supports programming

More information

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview

RDBMS Using Oracle. BIT-4 Lecture Week 3. Lecture Overview RDBMS Using Oracle BIT-4 Lecture Week 3 Lecture Overview Creating Tables, Valid and Invalid table names Copying data between tables Character and Varchar2 DataType Size Define Variables in SQL NVL and

More information

Mentor Graphics Predefined Packages

Mentor Graphics Predefined Packages Mentor Graphics Predefined Packages Mentor Graphics has created packages that define various types and subprograms that make it possible to write and simulate a VHDL model within the Mentor Graphics environment.

More information

None of the techniques used till now allows display of data from a after some arithmetic has been done it. Computations may include displaying

None of the techniques used till now allows display of data from a after some arithmetic has been done it. Computations may include displaying None of the techniques used till now allows display of data from a after some arithmetic has been done it. Computations may include displaying employee salary from the Employee_Master table along with

More information

CS-201 Introduction to Programming with Java

CS-201 Introduction to Programming with Java CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture V: Mathematical Functions, Characters, and Strings Introduction How would you estimate

More information

Installation and Configuration Guide

Installation and Configuration Guide Senturus Analytics Connector Version 2.2 Installation and Configuration Guide Senturus Inc. 533 Airport Blvd. Suite 400 Burlingame CA 94010 P 888 601 6010 F 650 745 0640 2017 Senturus, Inc. Table of Contents

More information

normalization are being violated o Apply the rule of Third Normal Form to resolve a violation in the model

normalization are being violated o Apply the rule of Third Normal Form to resolve a violation in the model Database Design Section1 - Introduction 1-1 Introduction to the Oracle Academy o Give examples of jobs, salaries, and opportunities that are possible by participating in the Academy. o Explain how your

More information

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017 Numerical Modelling in Fortran: day 2 Paul Tackley, 2017 Goals for today Review main points in online materials you read for homework http://www.cs.mtu.edu/%7eshene/courses/cs201/notes/intro.html More

More information

Index. Boolean expression, , Business rules enforcement. see Declarative constraints table with Oracle constraints and,

Index. Boolean expression, , Business rules enforcement. see Declarative constraints table with Oracle constraints and, Index ABS numeric function, 355 Active State Perl, SQL*Plus with, 61 ADD_MONTHS, 360 AFTER DELETE ROW trigger, 202 AFTER DELETE STATEMENT trigger, 202 AFTER-INSERT-ROW (AIR) trigger, 172 174, 177, 179

More information

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Macro Programming Reference Guide. Copyright 2005 Scott Martinez Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions

More information

Oracle Syllabus Course code-r10605 SQL

Oracle Syllabus Course code-r10605 SQL Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic

More information

INTRODUCTION TO MYSQL MySQL : It is an Open Source RDBMS Software that uses Structured Query Language. It is available free of cost. Key Features of MySQL : MySQL Data Types: 1. High Speed. 2. Ease of

More information

The Expressions plugin PRINTED MANUAL

The Expressions plugin PRINTED MANUAL The Expressions plugin PRINTED MANUAL Expressions plugin All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying,

More information

Installation and Configuration Guide

Installation and Configuration Guide Senturus Analytics Connector Version 2.2 Installation and Configuration Guide Senturus Inc 533 Airport Blvd. Suite 400 Burlingame CA 94010 P 888 601 6010 F 650 745 0640 Table of Contents 1. Install Senturus

More information

Oracle Database SQL Basics

Oracle Database SQL Basics Oracle Database SQL Basics Kerepes Tamás, Webváltó Kft. tamas.kerepes@webvalto.hu 2015. február 26. Copyright 2004, Oracle. All rights reserved. SQL a history in brief The relational database stores data

More information

SQL Reference Guide. For use with c-treesql Server. This manual describes syntax and semantics of SQL language statements and elements for c-treesql.

SQL Reference Guide. For use with c-treesql Server. This manual describes syntax and semantics of SQL language statements and elements for c-treesql. SQL Reference Guide For use with c-treesql Server This manual describes syntax and semantics of SQL language statements and elements for c-treesql. Copyright 1992-2002 FairCom Corporation All rights reserved.

More information

Basic types and definitions. Chapter 3 of Thompson

Basic types and definitions. Chapter 3 of Thompson Basic types and definitions Chapter 3 of Thompson Booleans [named after logician George Boole] Boolean values True and False are the result of tests are two numbers equal is one smaller than the other

More information

Script started on Thu 25 Aug :00:40 PM CDT

Script started on Thu 25 Aug :00:40 PM CDT Script started on Thu 25 Aug 2016 02:00:40 PM CDT < M A T L A B (R) > Copyright 1984-2014 The MathWorks, Inc. R2014a (8.3.0.532) 64-bit (glnxa64) February 11, 2014 To get started, type one of these: helpwin,

More information

Senturus Analytics Connector Version 3.0. User Guide. Senturus, Inc. 533 Airport Blvd. Suite 400 Burlingame CA P F

Senturus Analytics Connector Version 3.0. User Guide. Senturus, Inc. 533 Airport Blvd. Suite 400 Burlingame CA P F Senturus Analytics Connector Version 3.0 User Guide Senturus, Inc. 533 Airport Blvd. Suite 400 Burlingame CA 94010 P 888 601 6010 F 650 745 0640 Table of Contents 1. Install and Configure Senturus Analytics

More information

Visit for more.

Visit  for more. Chapter 10: MySQL Functions Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.) Kendriya

More information

Informix SQL Using New SQL Features

Informix SQL Using New SQL Features Informix SQL Using New SQL Features Jeff Filippi Integrated Data Consulting, LLC Session B01 Monday April 23 9:30am Introduction 21 years of working with Informix products 17 years as an Informix DBA Worked

More information

C Functions. 5.2 Program Modules in C

C Functions. 5.2 Program Modules in C 1 5 C Functions 5.2 Program Modules in C 2 Functions Modules in C Programs combine user-defined functions with library functions - C standard library has a wide variety of functions Function calls Invoking

More information

Customizing Built In Formulas

Customizing Built In Formulas Applies to: Software Component: SAP_BW. For more information, visit the EDW homepage. Summary This document demonstrates the performance of field routine as compared to formulas used in an update rule/

More information

Test: Mid Term Exam Semester 2 Part 1 Review your answers, feedback, and question scores below. An asterisk (*) indica tes a correct answer.

Test: Mid Term Exam Semester 2 Part 1 Review your answers, feedback, and question scores below. An asterisk (*) indica tes a correct answer. Test: Mid Term Exam Semester 2 Part 1 Review your answers, feedback, and question scores below. An asterisk (*) indica tes a correct answer. Section 1 (Answer all questions in this section) 1. Which comparison

More information

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data

1 Writing Basic SQL SELECT Statements 2 Restricting and Sorting Data 1 Writing Basic SQL SELECT Statements Objectives 1-2 Capabilities of SQL SELECT Statements 1-3 Basic SELECT Statement 1-4 Selecting All Columns 1-5 Selecting Specific Columns 1-6 Writing SQL Statements

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the fundamentals of SQL and PL/SQL along with the

More information

Transact-SQL Techniques

Transact-SQL Techniques Transact-SQL Techniques Transact-SQL, an extension to the SQL database programming language, is a powerful language offering many features. Transact-SQL provides the SQL Server developer with several useful

More information

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed

MATLAB Constants, Variables & Expression. 9/12/2015 By: Nafees Ahmed MATLAB Constants, Variables & Expression Introduction MATLAB can be used as a powerful programming language. It do have IF, WHILE, FOR lops similar to other programming languages. It has its own vocabulary

More information

Python Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17

Python Numbers. Learning Outcomes 9/19/2012. CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17 Python Numbers CMSC 201 Fall 2012 Instructor: John Park Lecture Section 01 Discussion Sections 02-08, 16, 17 1 (adapted from Meeden, Evans & Mayberry) 2 Learning Outcomes To become familiar with the basic

More information

Computational Physics

Computational Physics Computational Physics Python Programming Basics Prof. Paul Eugenio Department of Physics Florida State University Jan 17, 2019 http://hadron.physics.fsu.edu/~eugenio/comphy/ Announcements Exercise 0 due

More information

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000. QuickCalc User Guide. Number Representation, Assignment, and Conversion Variables Constants Usage Double (or DOUBLE ) floating-point variables (approx. 16 significant digits, range: approx. ±10 308 The

More information

Oracle Database: SQL and PL/SQL Fundamentals Ed 2

Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals

More information

Oracle Database 11g: SQL and PL/SQL Fundamentals

Oracle Database 11g: SQL and PL/SQL Fundamentals Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 4-3 Objectives This lesson covers the following objectives: Demonstrate the use of SYSDATE and date functions State the implications for world businesses to be able to easily

More information

Objectives. You will learn how to process data in ABAP

Objectives. You will learn how to process data in ABAP Objectives You will learn how to process data in ABAP Assigning Values Resetting Values to Initial Values Numerical Operations Processing Character Strings Specifying Offset Values for Data Objects Type

More information

Downloaded from

Downloaded from UNIT 3 CHAPTER 13: DATABASE FUNDAMENTALS - MYSQL REVISION TOUR Database: Collection of logically related data stored in a structure format. DBMS: Software used to manage databases is called Data Base Management

More information

Relational Database Language

Relational Database Language DATA BASE MANAGEMENT SYSTEMS Unit IV Relational Database Language: Data definition in SQL, Queries in SQL, Insert, Delete and Update Statements in SQL, Views in SQL, Specifying General Constraints as Assertions,

More information

Unit 4. Scalar Functions and Arithmetic

Unit 4. Scalar Functions and Arithmetic Unit 4. Scalar Functions and Arithmetic What This Unit Is About Scalar functions can be used to manipulate column or expression values. This unit will discuss the format and syntax of basic scalar functions.

More information

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types

Introduction to Computer Programming in Python Dr. William C. Bulko. Data Types Introduction to Computer Programming in Python Dr William C Bulko Data Types 2017 What is a data type? A data type is the kind of value represented by a constant or stored by a variable So far, you have

More information

Advanced SQL Tribal Data Workshop Joe Nowinski

Advanced SQL Tribal Data Workshop Joe Nowinski Advanced SQL 2018 Tribal Data Workshop Joe Nowinski The Plan Live demo 1:00 PM 3:30 PM Follow along on GoToMeeting Optional practice session 3:45 PM 5:00 PM Laptops available What is SQL? Structured Query

More information

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4 BIL 104E Introduction to Scientific and Engineering Computing Lecture 4 Introduction Divide and Conquer Construct a program from smaller pieces or components These smaller pieces are called modules Functions

More information

SAS Web Report Studio Performance Improvement

SAS Web Report Studio Performance Improvement SAS Web Report Studio Performance Improvement Using Stored Processes in Information Map Studio A tale of two methods Direct access to relational databases Including: DB2, SQL, MySQL, ODBC, Oracle, Teradata,

More information

Unit 6. Scalar Functions

Unit 6. Scalar Functions Unit 6. Scalar Functions What This Unit Is About This unit provides information on how to use various common scalar functions. What You Should Be Able to Do After completing this unit, you should be able

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Fall 2003 This document is a quick reference guide to common features of the Scheme language. It is not intended to be a complete language reference, but it gives terse summaries

More information

The Expressions plugin PRINTED MANUAL

The Expressions plugin PRINTED MANUAL The Expressions plugin PRINTED MANUAL Expressions plugin All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying,

More information

LAB 1 General MATLAB Information 1

LAB 1 General MATLAB Information 1 LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by

More information

DB2 SQL Class Outline

DB2 SQL Class Outline DB2 SQL Class Outline The Basics of SQL Introduction Finding Your Current Schema Setting Your Default SCHEMA SELECT * (All Columns) in a Table SELECT Specific Columns in a Table Commas in the Front or

More information

Reporting Functions & Operators

Reporting Functions & Operators Functions Reporting Functions & Operators List of Built-in Field Functions Function Average Count Count Distinct Maximum Minimum Sum Sum Distinct Return the average of all values within the field. Return

More information

Oracle Database: Introduction to SQL Ed 2

Oracle Database: Introduction to SQL Ed 2 Oracle University Contact Us: +40 21 3678820 Oracle Database: Introduction to SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database 12c: Introduction to SQL training helps you write subqueries,

More information

Topic 8 Structured Query Language (SQL) : DML Part 2

Topic 8 Structured Query Language (SQL) : DML Part 2 FIT1004 Database Topic 8 Structured Query Language (SQL) : DML Part 2 Learning Objectives: Use SQL functions Manipulate sets of data Write subqueries Manipulate data in the database References: Rob, P.

More information

FORMULAS QUICK REFERENCE

FORMULAS QUICK REFERENCE FORMULAS QUICK REFERENCE Summary Working with formulas? Find out which operators can be used in which formulas and what each one does. Math Operators Operator + (Add) Calculates the sum of two values.

More information

Computer Science 121. Scientific Computing Winter 2016 Chapter 3 Simple Types: Numbers, Text, Booleans

Computer Science 121. Scientific Computing Winter 2016 Chapter 3 Simple Types: Numbers, Text, Booleans Computer Science 121 Scientific Computing Winter 2016 Chapter 3 Simple Types: Numbers, Text, Booleans 3.1 The Organization of Computer Memory Computers store information as bits : sequences of zeros and

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how

More information

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries

Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries Computer Programming 5th Week loops (do-while, for), Arrays, array operations, C libraries Hazırlayan Asst. Prof. Dr. Tansu Filik Computer Programming Previously on Bil 200 Low-Level I/O getchar, putchar,

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Winter 2003 February 10, 2003 1 Introduction This document is a quick reference guide to common features of the Scheme language. It is by no means intended to be a complete

More information

SWITCH(DatePart("w",DateOfYear) IN(1,7),"Weekend",DatePart("w",DateOfYear) IN(2,3,4,5,6),"Weekday") AS DayType,

SWITCH(DatePart(w,DateOfYear) IN(1,7),Weekend,DatePart(w,DateOfYear) IN(2,3,4,5,6),Weekday) AS DayType, SeQueL 4 Queries and their Hidden Functions! by Clark Anderson A friend recently exclaimed Can you really use this function in SQL! In this article of my series I will explore and demonstrate many of the

More information

Table of Contents. PDF created with FinePrint pdffactory Pro trial version

Table of Contents. PDF created with FinePrint pdffactory Pro trial version Table of Contents Course Description The SQL Course covers relational database principles and Oracle concepts, writing basic SQL statements, restricting and sorting data, and using single-row functions.

More information

JUN / 04 VERSION 7.0

JUN / 04 VERSION 7.0 JUN / 04 VERSION 7.0 PVI EWEXEME www.smar.com Specifications and information are subject to change without notice. Up-to-date address information is available on our website. web: www.smar.com/contactus.asp

More information

Basics of ST. Each must end with a semi-colon (";") Basic statement. Q:=IN; Q:=sin(angle); Q := (IN1 + (IN2 / IN 3)) * IN4;

Basics of ST. Each must end with a semi-colon (;) Basic statement. Q:=IN; Q:=sin(angle); Q := (IN1 + (IN2 / IN 3)) * IN4; Excerpt of tutorial developed at University of Auckland by Gulnara Zhabelova Based on Dr. Valeriy Vyatkin s book IEC 61499 Function Blocks for Embedded and Distributed Control Systems Design, Second Edition

More information

Math 2250 MATLAB TUTORIAL Fall 2005

Math 2250 MATLAB TUTORIAL Fall 2005 Math 2250 MATLAB TUTORIAL Fall 2005 Math Computer Lab The Mathematics Computer Lab is located in the T. Benny Rushing Mathematics Center (located underneath the plaza connecting JWB and LCB) room 155C.

More information

Using the um-fpu with the Javelin Stamp

Using the um-fpu with the Javelin Stamp Using the um-fpu with the Javelin Stamp Introduction The um-fpu is a 32-bit floating point coprocessor that can be easily interfaced with the Javelin Stamp to provide support for 32-bit IEEE 754 floating

More information

MATHEMATICAL / NUMERICAL FUNCTIONS

MATHEMATICAL / NUMERICAL FUNCTIONS MATHEMATICAL / NUMERICAL FUNCTIONS Function Definition Syntax Example ABS (Absolute value) ASC It returns the absolute value of a number, turning a negative to a positive (e.g. - 4 to 4) It returns the

More information

SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database.

SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL*Plus SQL*Plus is an application that recognizes & executes SQL commands &

More information

Introduction to GNU-Octave

Introduction to GNU-Octave Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016

More information

Functions. Systems Programming Concepts

Functions. Systems Programming Concepts Functions Systems Programming Concepts Functions Simple Function Example Function Prototype and Declaration Math Library Functions Function Definition Header Files Random Number Generator Call by Value

More information