3. About The Speaker
Christopher Merry is principle consultant at Clearwater
Technical Group
Oracle Certified Professional and Certified Professional in
Learning and Performance
10 years of experience working with Oracle
Including time at Oracle Corporation
9 years of experience as a trainer for Learning Tree International
3 years of experience working with several universities to
migrate SunGard Advance from Sybase to Oracle
1-3 Sybase to Oracle Migration - Developers
4. About This Presentation
Developed to identify significant differences between Sybase
and Oracle database environments
Part of a series prepared by CTG to assist clients (and others) in
their for migration challenges ahead
Other presentations include
Sybase to Oracle Migration for DBAs
Sybase to Oracle Data Migration Steps
Sybase to Oracle - T/SQL and PL/SQL
Bridging the Gap Between Advance Windows and AWA
Web Skills for AWA Customization
And more on the way
1-4 Sybase to Oracle Migration - Developers
5. About CTG
CTG is a small technical group specializing in Oracle consulting
with key experience assisting several universities migrate from
SunGard’s Advance Windows to Advance Web Access
CTG is not in anyway affiliated or partnered with SunGard Data
Systems, Inc.
1-5 Sybase to Oracle Migration - Developers
6. Objectives
Evaluate the tools available to access an Oracle database
Oracle tools
Third party applications
Compare data type options in both environments
Identify significant differences in SQL
Temporary tables
Updates
Grouping
Discuss transaction and data control
Evaluate schemas, privileges, and synonyms in Oracle
1-6 Sybase to Oracle Migration - Developers
8. Oracle Supplied Tools
Complimentary tools from Oracle are available to access Oracle
databases
Limited in functionality
Oracle Database 10g tools include:
SQL*Plus
Command line tool similar to SQL Advantage or isql
SQL Developer
Oracle’s newest access tool
Java application
Includes data migration features to import Sybase objects into Oracle
A little buggy and not as feature rich as other options
1-8 Sybase to Oracle Migration - Developers
9. SQL*Plus
1-9 Sybase to Oracle Migration - Developers
11. Third Party Tools
Many third party options are available
Product cost varies based on version and features desired
Popular software includes
Golden
Basic, inexpensive product ($35) offering many features used by developers
Toad
The dominant Oracle tool for years, Toad was once a free product
Now owned by Quest Software, it is one of the higher priced options
Starting at $870 for the basic edition (additional modules are available)
1-11 Sybase to Oracle Migration - Developers
12. Third Party Tools (cont’d)
More software options
SQL Navigator
The flagship Quest Software Oracle tool
The highest cost among the products mentioned here
Base edition starts are $1,300 with additional editions retailing for $3,000
PL/SQL Developer - HIGHLY RECOMMENDED
The best feature set for the money
Offered by Allround Automations
Single license cost is $180 with discounts for multiple license packages
1-12 Sybase to Oracle Migration - Developers
15. Data Types
While many data types differ between Sybase and Oracle, DATE
values are the most significantly different
CHAR
Exists in both environments
Sybase maximum length is 255 characters; Oracle maximum length is
2000 bytes
VARCHAR
Exists in both environments
Sybase maximum length is 255 characters; Oracle maximum length is
4000 bytes
Oracle also includes VARCHAR2, which is the recommended data type
1-15 Sybase to Oracle Migration - Developers
16. Data Types (cont’d)
TEXT
The Oracle equivalent is VARCHAR2 (up to 4000 bytes) or CLOB for text
up to and beyond 4GB
NUMERIC, DECIMAL, INT
Available in both environments
Exist as subtypes in Oracle
NUMBER is Oracle’s standard numeric data type
FLOAT
Available in both environments
1-16 Sybase to Oracle Migration - Developers
17. Data Types (cont’d)
REAL, TINYINT, SMALLINT, MONEY, SMALLMONEY
Not available in Oracle; must use equivalent NUMBER definitions
Dates
All DATE values are stored in Oracle as a 7 byte field that always
includes century, year, month, day, hours, minutes, and seconds
Date formating is handled using format models
YYYY represents a four digit year and MON represents the first three characters of a
month (e.g. DD-MON-YYYY represents 01-JAN-2010)
TIMESTAMP
Available in both environments
Contains fractions of a second in Oracle
1-17 Sybase to Oracle Migration - Developers
18. User-Defined Data Types
Oracle supports user-defined data types through the creation of
Object Types
The implementation is quite different from Sybase user-defined
data types
Requires special SQL constructs
More complex
1-18 Sybase to Oracle Migration - Developers
19. NULL Character Strings
Empty character strings ('') are treated the same as NULL
values in Oracle
This is significant as conditions such as the following will never
be true (even if the STREET2 value is empty)
IF TRIM(street2) > '' THEN
Instead, the condition should use the IS NOT NULL operator
IF TRIM(street2) IS NOT NULL THEN
1-19 Sybase to Oracle Migration - Developers
21. Structured Query Language
Oracle and Sybase are ANSI standard complient
The majority of SQL syntax is identical
Some functionality is available in both environments with different syntax and
terminology
Sybase provides a few additional features not found in Oracle
Oracle provides a few additional features not found in Sybase
Key differences include
Temporary tables
Subqueryies in update and delete statements
Group By rules
1-21 Sybase to Oracle Migration - Developers
22. Temporary Tables
One of the biggest issues associated with converting existing
Sybase scripts and stored procedures to Oracle is the lack of
pure temporary tables in Oracle
Oracle does make use of Global Temporary Tables; however, the
behavior of these objects is not strictly “temporary” in nature
These objects can be used as an alternative; however, the creation of
global temporary tables will significantly increase the number objects in
the database
Other alternatives include
PL/SQL collections
Advanced SQL techniques
1-22 Sybase to Oracle Migration - Developers
23. Updates with Subqueries
Oracle does not allow the FROM clause in the UPDATE
statement
Therefore, the following statement is not valid in Oracle
UPDATE address
SET street1 = 'New Address'
FROM entity e, address a
WHERE e.id_number = a.id_number
AND a.addr_pref_ind = 'Y'
AND e.report_name = 'JOHN DOE'
1-23 Sybase to Oracle Migration - Developers
24. Updates with Subqueries (cont’d)
The following statement would be valid in both environments
UPDATE address a
SET street1 = 'New Address'
WHERE EXISTS ( SELECT 1
FROM entity e
WHERE e.id_number = a.id_number
AND a.addr_pref_ind = 'Y'
AND e.report_name = 'JOHN DOE' )
1-24 Sybase to Oracle Migration - Developers
25. Group By Restrictions
When mixing scalar values and aggregate functions, Oracle
requires all scalar values to be included in the GROUP BY
clause
For example, the following statement, which is valid in Sybase,
will not execute in Oracle
The statement is intended to retrieve each gift given by an entity, along
with a total amount given in the last column
SELECT id_number, gift_amount
, SUM(gift_amount) AS gift_total
FROM gift
GROUP BY id_number
NOTE: Analytic functions can be used to generate the desired results
1-25 Sybase to Oracle Migration - Developers
28. Functions
Oracle provides many functions available in both SQL and PL/
SQL
Many functions are either the same or only slightly different
There are significant differences in a few types of functions
Date functions
Regular Expressions
Analytic Functions
1-28 Sybase to Oracle Migration - Developers
29. Analytic Function Example
Resolve the earlier grouping issue using an analytic function
Also include a ranking column to indicate the gift value in descending
order
SELECT id_number
, gift_amount
, RANK()
OVER( PARTITION BY id_number
ORDER BY gift_amount DESC ) AS gift_rank
, SUM(gift_amount)
OVER( PARTITION BY id_number ) AS gift_total
FROM gift
1-29 Sybase to Oracle Migration - Developers
31. Regular Expression Function Example
Reformat a character string that represents a date value
The original data format is YYYYMMDD; the output is MM/DD/YYYY
SELECT birth_dt
, REGEXP_REPLACE
( birth_dt
, '([12][890][0-9]{2})([01][0-9])([0-3][0-9])'
, '2/3/1' ) AS formated_bday
FROM entity
BIRTH_DT FORMATED_B
-------- ----------
19520626 06/26/1952
00000613
19540608 06/08/1954
19450703 07/03/1945
1-31 Sybase to Oracle Migration - Developers
33. Transactions
Oracle never commits a single INSERT, UPDATE, or DELETE
statement
Assuming the user does not disconnect from the current session
Similar behavior to the Sybase BEGIN TRANSACTION statement
Until a user issues a COMMIT statement, changes made in one
session cannot be seen in another session
A read consistent view of the data is available in the other session
1-33 Sybase to Oracle Migration - Developers
35. Schemas and Privileges
Oracle segregates data in schemas
Users that create objects such as tables and stored procedures have a
schema
Users that only access other’s objects do not have a schema
If a user does not own an object, privilege must be granted to
the user for the object
GRANT SELECT ON advance.entity TO chris
1-35 Sybase to Oracle Migration - Developers
36. Accessing Schema Objects
Using the previous example, if the user CHRIS executes the
query below, the ENTITY table in the ADVANCE schema may not
be accessed
SELECT * FROM entity
To ensure the ADVANCE schema is used, execute
SELECT * FROM advance.entity
An exception to this behavior would occur if
The user does not have a table of the same name in his or her own
schema AND
A synonym exist for the ADVANCE.ENTITY table
A synonym “redirects” access to an object in another schema
1-36 Sybase to Oracle Migration - Developers
38. Migration Road Map
Of course this presentation only illustrates a few of the
differences between Oracle and Sybase
For more details regarding Oracle, take a look at the
documentation available on Oracle’s website
Contact us if you have questions regarding this or any of our
other presentation
(888) 347-7477
info@clearwatertg.com
http://www.clearwatertg.com
1-38 Sybase to Oracle Migration - Developers