Comparing SQL Server and Oracle Comparing Oracle and SQL Server Similarities Similar Schema Objects (tables, views) Similar Datatypes Referential Integrity.

Slides:



Advertisements
Similar presentations
The Architecture of Oracle
Advertisements

Module 2: Database Architecture
Manipulating Data Schedule: Timing Topic 60 minutes Lecture
1 Data Concurrency David Konopnicki 1997 Revised by Mordo Shalom 2004.
Introduction to Structured Query Language (SQL)
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 8 Advanced SQL.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Introduction to Structured Query Language (SQL)
Beginning SQL: Differences Between SQL Server and Oracle Les Kopari Independent Consultant A Quick Intro for SQL Server Users.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 13 Managing Databases with SQL Server 2000.
PL / SQL P rocedural L anguage / S tructured Q uery L anguage Chapter 7 in Lab Reference.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 8 Advanced SQL.
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Database Technical Session By: Prof. Adarsh Patel.
Lecture 4 PL/SQL language. PL/SQL – procedural SQL Allows combining procedural and SQL code PL/SQL code is compiled, including SQL commands PL/SQL code.
Oracle Database Administration Lecture 3  Transactions  SQL Language: Additional information  SQL Language: Analytic Functions.
1099 Why Use InterBase? Bill Todd The Database Group, Inc.
Oracle Locking Michael Messina Principal Database Analyst Indiana University.
1 Oracle Architectural Components. 1-2 Objectives Listing the structures involved in connecting a user to an Oracle server Listing the stages in processing.
7 1 Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
10-1 Copyright  Oracle Corporation, All rights reserved. Database Objects ObjectDescription TableBasic unit of storage; composed of rows and columns.
Copyright  Oracle Corporation, All rights reserved. 10 Creating and Managing Tables.
6 1 Lecture 8: Introduction to Structured Query Language (SQL) J. S. Chou, P.E., Ph.D.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Chapter 3 Selected Single-Row Functions and Advanced DML & DDL.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 8 Advanced SQL.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
PL/SQL Block Structure DECLARE - Optional Variables, cursors, user-defined exceptions BEGIN - Mandatory SQL Statements PL/SQL Statements EXCEPTIONS - Optional.
Chapter 6 Procedural Language SQL and Advanced SQL Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Introduction to Oracle. Oracle History 1979 Oracle Release client/server relational database 1989 Oracle Oracle 8 (object relational) 1999.
Chapter 15 Introduction to PL/SQL. Chapter Objectives  Explain the benefits of using PL/SQL blocks versus several SQL statements  Identify the sections.
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Transactions and Locks A Quick Reference and Summary BIT 275.
What is a Package? A package is an Oracle object, which holds other objects within it. Objects commonly held within a package are procedures, functions,
Database Lab Lecture 1. Database Languages Data definition language ( DDL ) Data definition language –defines data types and the relationships among them.
SQL: Part 1 Original materials supplied by the Oracle Academic Initiative (OAI). Edited for classroom use by Professor Laku Chidambaram. Not for commercial.
Database Fundamental & Design by A.Surasit Samaisut Copyrights : All Rights Reserved.
06 | Modifying Data in SQL Server Brian Alderman | MCT, CEO / Founder of MicroTechPoint Tobias Ternstrom | Microsoft SQL Server Program Manager.
Visual Programing SQL Overview Section 1.
D Copyright © Oracle Corporation, All rights reserved. Loading Data into a Database.
IMS 4212: Data Manipulation 1 Dr. Lawrence West, MIS Dept., University of Central Florida Additional Data Manipulation Statements INSERT.
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Session 1 Module 1: Introduction to Data Integrity
Module 11: Managing Transactions and Locks
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Starting with Oracle SQL Plus. Today in the lab… Connect to SQL Plus – your schema. Set up two tables. Find the tables in the catalog. Insert four rows.
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
Oracle10g Developer: PL/SQL Programming1 Objectives Named program units How to identify parameters The CREATE PROCEDURE statement Creating a procedure.
 CONACT UC:  Magnific training   
3 Copyright © 2004, Oracle. All rights reserved. Database Architecture Comparison.
SQL Server Migration Hints and Tips Manual conversion required Complex triggers References to data dictionary tables (systables,…) Recent extensions.
13 Copyright © 2004, Oracle. All rights reserved. Migrating SQL Statements.
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
7 Copyright © 2004, Oracle. All rights reserved. Managing Schema Objects.
1 Copyright © 2004, Oracle. All rights reserved. PL/SQL Programming Concepts: Review.
Oracle Database Architectural Components
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Oracle SQL.
Relational Database Design
ATS Application Programming: Java Programming
Oracle vs. MS SQL Server Duration: 1 Hour.
DATABASE MANAGEMENT SYSTEM
Database systems Lecture 3 – SQL + CRUD
Index Note: A bolded number or letter refers to an entire lesson or appendix. A Adding Data Through a View ADD_MONTHS Function 03-22, 03-23,
Contents Preface I Introduction Lesson Objectives I-2
Chapter 8 Advanced SQL.
Chapter 11 Managing Databases with SQL Server 2000
Presentation transcript:

Comparing SQL Server and Oracle

Comparing Oracle and SQL Server Similarities Similar Schema Objects (tables, views) Similar Datatypes Referential Integrity Check Constraints / Rules Transaction Support Triggers and Stored Subprograms SQL Access to System Catalogs

Comparing Data Types SQL ServerOracle INTEGERNUMBER(10) SMALLINTNUMBER(6) TINYINTNUMBER(3) DECIMAL(p,[q])NUMBER(p,[q]) NUMERIC(p,[q])NUMBER(p,[q]) REALFLOAT FLOAT[(p)] BITNUMBER(1) CHAR(n) VARCHAR(n)VARCHAR2(n) NCHAR(n)CHAR(n*2) NVARCHAR(n)VARCHAR2(n*2)

Comparing Data Types SQL ServerOracle TEXTCLOB IMAGEBLOB BINARY(n)RAW(n), BLOB VARBINARY(n)RAW(n), BLOB DATETIMEDATE (or TIMESTAMP) SMALLDATETIMEDATE MONEYNUMBER(19,4) SMALLMONEYNUMBER(10,4) TIMESTAMPNUMBER SYSNAMEVARCHAR2(30)

Comparing Oracle and SQL Server Organization Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Comparing Oracle and SQL Server What is a database? Oracle database: Collection of schemas Stored in tablespaces Central schema: SYSTEM SQL Server database = Oracle schema Memory Processes SYSTEM Schema 1 Schema 2 Schema 3 Memory Processes Master, model,msdb, tempdb Database 1 Database 2 Database 3 Oracle instance = SQL Server server (Database plus processes)

Comparing Storage Structures Oracle Database Tablespace Segment Extent Block SQL Server Database Filegroup Extent (64 KB fixed) Page (8 KB fixed)

SQL Server Storage Structures Fundamental storage unit: Page (8 KB fixed) Basic unit to allocate space to tables and indexes: Extent (64 KB fixed) OS file: Primary data file Secondary data file Database Log file Filegroup

Oracle Storage Structures Fundamental storage unit: Block A logical block consists of one or more OS blocks. The size of a logical block is defined by an initialization parameter. OS block Tablespace LogicalPhysical Extent Segment Block Data file

Comparing Oracle and SQL Server Terminology Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Differences in Terminology Oracle spfile(auto managed binary) = SQL Server sysconfig Oracle v$, USER_TABLES = SQL Server sp_ stored procedures, sysxxx tables Oracle has schemas/tablespaces = SQL Server databases/devices Oracle has redo buffer cache, redo logs for archiving = SQL Server transaction log Oracle has UNDO space for read consistency = no equivalent in SQL Server* (SS2K5) Oracle SQL*PLUS (/) = SQL Server ISQL (go)

Connecting to the Database With multiple databases in SQL Server, you use the following command to switch databases: With only one database in Oracle, you issue one of the following commands to switch schemas: OR SQL> Use hr SQL> CONNECT hr/hr; SQL> ALTER SESSION SET CURRENT_SCHEMA=HR;

Comparing Schema Objects Oracle schema objects not available in SQL Server: Database link Profile Materialized view Sequence (SQL Server: Serial data type) Synonym SQL Server rule, integrity, and default are implemented as constraints of Oracle tables.

Naming Database Objects Names must be from 1 to 30 bytes long with these exceptions: Names of databases are limited to 8 bytes. Names of database links can be as long as 128 bytes. Nonquoted names cannot be Oracle-reserved words. Nonquoted names must begin with an alphabetic character from your database character set.

Naming Database Objects Nonquoted names can contain only: Alphanumeric characters from your database character set The underscore (_) Dollar sign ($) Pound sign (#) No two objects can have the same name within the same namespace. MS Tip: OMWB assists with resolving naming conflicts.

Comparing Oracle and SQL Server Connection Models Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Differences in Connection Models The Oracle server is “connection-based”. It offers: Multiple active result-sets per connection Only one connection needed Multiple sessions per connection Multiple transactions per session Distributed database access via database links SQL Server is “stream-based”. It offers: One active result-set per connection Typically several connections used

Comparison of Oracle and SQL Server Differences in Connections – Result Sets Application maintaining SQL handles Application maintaining SQL handles Procedure P() Begin... SELECT End Procedure P() Begin... SELECT End Application calling stored procedure with result set Application calling stored procedure with result set SQL SQL Client Server Result Set

SQL Server automatically put resultsets in stream Returns data in Tablular Data Stream format (TDS) Multiple resultsets possible Oracle provides cursor variables Client receives cursor variable Cursor Variable is a handle to server side memory resident cursor Client fetches as much of data as desired Multiple Cursor Variables easily accommodated Can pass Cursor Variable to other clients or servers Handling Result Sets

Comparing Oracle and SQL Server Transaction & Isolation Models Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Comparing Transactional Models OracleSQL Server ‘Readers’ never block ‘writers’ Read locks provide consistency, but may block ‘writers’. ‘Read’ transactions are always consistent. ’Dirty reads’, i.e. reads of uncommitted data allowed to bypass locks True row-level locksN/A Locks never escalateLocks escalate as numbers increase Locking on with the blockLocking in memory

Transactional Models Oracle supports always full Isolation Model Only committed data visible to other users Allows repeatable reads SQL Server allows several modes SET TRANSACTION ISOLATION LEVEL … for each transaction Uses BROWSE mode (timestamp) to detect update conflicts (optimistic locking) Transaction Handling

Oracle has implicit Transactions All SQL statements are transaction controlled No BEGIN TRANSACTION - a new transaction begins at the end of the previous one Transaction ends at COMMIT or ROLLBACK Nested Transactions could be defined via SAVEPOINT SQL Server programmers use explicit Transactions Programmers may explicitly use BEGIN, END TRANSACTION and control COMMIT/ROLLBACK manually. If not in an explicit transaction, each statement auto-commits after execution Nested Transactions do not commit but may rollback Transaction Handling Transactional Models

Comparing the Transaction Models Key differences between the transaction models: SQL ServerOracle Begin a transaction. ExplicitImplicit End a transaction. Uses auto-commit mode by default Requires the COMMIT statement by default

Beginning a Transaction SQL Server begins transactions explicitly: The Oracle database begins transactions implicitly: SQL> INSERT INTO regions VALUES (5, Southeast Asia’); 2 INSERT INTO countries VALUES (‘VN’,‘Vietnam’, 5); 3 COMMIT; SQL> BEGIN TRANSACTION 2 INSERT INTO regions VALUES (5, ‘Southeast Asia’) 3 INSERT INTO countries VALUES (‘VN’, ‘Vietnam’, 5) 4 COMMIT TRANSACTION

Ending a Transaction SQL Server always commits statements if outside an explicit transaction: With Oracle you always need to COMMIT or ROLLBACK SQL> INSERT INTO regions 2 VALUES (6, ‘South America’); 3 COMMIT; 4 INSERT INTO countries 5 VALUES (‘PE’, ‘Peru’, 6) 6 COMMIT; SQL> INSERT INTO regions 2 VALUES (6, ‘South America’) 3 INSERT INTO countries 4 VALUES (‘PE’, ‘Peru’, 6) Transaction #1 Transaction #2 Transaction #1 Transaction #2

Comparing Isolation Levels Isolation levels supported by SQL Server and Oracle: Isolation LevelSQL ServerOracle Read uncommitted Read committedDefault Repeatable read Serializable * * * Read Only Transactions only

Data Concurrency Full Notes Page

Comparing Oracle and SQL Server Temporary Tables Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Temporary Tables SQL Server: Local temporary tables, names beginning with # Global temporary tables, names beginning with ## Not compatible with Oracle’s naming conventions Options in Oracle: Temporary ANSI-style (global temporary) tables Multitable joins (optimized internally) Materialized views PL/SQL tables

Full Notes Page

Temporary Tables Data exists only for the duration of a transaction or session Data only visible within a single transaction or session No redo generated, only undo Data segments created in a user’s temporary tablespace CREATE GLOBAL TEMPORARY TABLE emp_temp( eno NUMBER, ename VARCHAR2(20), sal NUMBER) ON COMMIT DELETE ROWS; INSERT INTO emp_temp VALUES( 101,’Inga’,1000); SELECT count(*) FROM emp_temp; INSERT INTO emp_temp VALUES( 101,’Inga’,1000); SELECT count(*) FROM emp_temp;

Comparing Oracle and SQL Server Programming Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Migrate a table with an IDENTITY column Oracle doesn't support the IDENTITY attribute. If you want an auto-incrementing column in Oracle, then create a sequence and use that sequence in a trigger associated to the table

Migrate a table with an IDENTITY column SQL Server version Create the Table Insert Row SQL> CREATE TABLE Friend ( 2 FriendID INT IDENTITY PRIMARY KEY NOT NULL, 3 Name VARCHAR(50), 4 PhoneNo VARCHAR(15)DEFAULT ‘Unknown Phone’) SQL> INSERT INTO Friend (Name, PhoneNO) 2 VALUES (‘Mike’,’ ’);

Migrate a table with an IDENTITY column Oracle version Create the Table Insert Row SQL> CREATE TABLE Friend ( 2 FriendID NUMBER PRIMARY KEY NOT NULL, 3 Name VARCHAR(50), 4 PhoneNo VARCHAR(15)DEFAULT ‘Unknown Phone’) SQL> INSERT INTO Friend (Name, PhoneNO) 2 VALUES (‘Mike’,’ ’);

Migrate a table with an IDENTITY column Oracle version cont. Create the Sequence Create the Trigger SQL> CREATE SEQUENCE SEQ; SQL> CREATE OR REPLACE TRIGGER FRIEND_AUTO_NUMBER 2 BEFORE INSERT ON Friend 3 FOR EACH ROW 4 BEGIN 5 SELECT SEQ.NEXTVAL INTO :NEW.FriendID FROM DUAL; 6 END;

SQL> SELECT customer_id, date_of_birth 2 FROM customers 3 WHERE cust_ = ‘ ’ Null Handling Semantics SQL Server interprets the empty string as a single blank space. Oracle interprets the empty string as NULL value. Rewrite to use a single blank space and not the empty string. SQL> SELECT customer_id, date_of_birth 2 FROM customers 3 WHERE cust_ = ‘’

SQL Comparison

Oracle Reserved Words Many words are valid in SQL Server 2005 but are reserved words Oracle11g: Modify SQL statements to not use Oracle reserved words. WordSQL ServerOracle ACCESS COMMENT DATE GROUP LEVEL

Object Name Changes The way to reference a table or view in a SQL statement is different: SQL Server database_name.owner_name.table_name Oracle user_schema.table_name Example accessing other schema: SQL ServerOracle SELECT * FROM oe.oe_dba.ordersSELECT * FROM oe.orders

Displaying Information about an object In Oracle use the SQL*Plus DESCRIBE command to display the structure of a table. OracleMicrosoft SQL Server DESCRIBE table_name SP_HELP table_name

SELECT Statement Oracle SELECT statement is similar to the SQL Server SELECT statement. ClauseDescription SELECT Columns returned FROM Tables where data is retrieved WHERE Conditions to restrict rows returned GROUP BY Returns single row of summary information for each group HAVING Conditions to restrict groups returned ORDER BY Sorts rows returned HandoutHandout

SELECT Statement: FROM Clause In SQL Server, FROM clause is optional. In Oracle, FROM clause is required. SQL> SELECT sysdate FROM dual; SQL> SELECT getdate()

SELECT Statement: SELECT INTO Clause In SQL Server, SELECT INTO clause is used. In Oracle, if the table exists, rewrite using the INSERT INTO clause. SQL> INSERT INTO contacts 2 SELECT cust_first_name, cust_last_name 3 FROM customers; SQL> SELECT cust_first_name, cust_last_name 2 INTO contacts 3 FROM customers

SELECT Statement: SELECT INTO Clause cont. In SQL Server, SELECT INTO clause is used. In Oracle, if the table does not exist, rewrite using the Create table as select clause. SQL> CREATE contacts AS 2 SELECT cust_first_name, cust_last_name 3 FROM customers SQL> SELECT cust_first_name, cust_last_name 2 INTO contacts 3 FROM customers

SELECT Statement: Column Alias In SQL Server, example using column alias: In Oracle, column alias is placed after the column name SQL> SELECT cust_ 2 FROM customers; SQL> SELECT = cust_ 2 FROM customers

Comparing Subqueries to Subqueries Microsoft SQL Server and Sybase Adaptive Server also allow a SELECT statement in the WHERE clause. Change it to the ANSI-standard below for Oracle OracleMicrosoft SQL Server SELECT empname, deptname FROM emp, dept WHERE emp.empno = 100 AND EXISTS (SELECT security_code FROM employee_security es WHERE es.empno = emp.empno AND es.security_code = (SELECT security_code FROM security_master WHERE sec_level = dept.sec_level)); SELECT empname, deptname FROM emp, dept WHERE emp.empno = 100 AND(SELECT security_code FROM employee_security WHERE empno = emp.empno) = (SELECT security_code FROM security_master WHERE sec_level = dept.sec_level) HandoutHandout

Using SELECT Statements as Table Names OracleMicrosoft SQL Server SELECT * FROM (SELECT * FROM titles) “MYTITLES” SELECT * FROM (SELECT * FROM titles) AS “MYTITLES” Microsoft SQL Server and Oracle support the use of SELECT statements as the source of tables when performing queries. SQL Server requires an alias; the use of an alias is optional with Oracle but if used remove the AS keyword. HandoutHandout

SELECT Statement: TOP n Clause In SQL Server, TOP clause is gives you the top n rows retrieved in the result set. In Oracle, you must do a subselect and use ROWNUM SQL> SELECT * FROM (SELECT empname, total_com FROM emp ORDER BY total_com )WHERE ROWNUM < 6 SQL> SELECT TOP 5 empname, total_com FROM emp ORDER BY total_com

INSERT Statement In SQL Server, the INTO clause is optional. In Oracle, the INTO clause is required. SQL> INSERT INTO regions 2 VALUES (202, ‘Southeast’); SQL> INSERT regions 2 VALUES (202, ‘Southeast’)

UPDATE statement SQL Server example: Rewrite in Oracle: SQL> UPDATE inventories 2 SET quantity_on_hand = 0 3 WHERE product_id IN (SELECT product_id 4 FROM product_information 5 WHERE product_status = ‘planned’); SQL> UPDATE inventories 2 SET quantity_on_hand = 0 3 FROM inventories i, product_information p 4 WHERE p.product_id = p.product_id 5 and product_status=‘planned’

DELETE statement SQL Server: Rewrite in Oracle: SQL> DELETE FROM inventories 2 FROM inventories i, product_information p 3 WHERE i.product_id = p.product_id 4 AND supplier_id = SQL> DELETE FROM inventories 2 WHERE product_id IN (SELECT product_id 3 FROM product_information 4 WHERE supplier_id = );

Operators Examples of operator differences: SQL ServerOracle Value Comparison WHERE qty !< 100WHERE qty >= 100 Null Value Comparison WHERE status = NULLWHERE status IS NULL String Concatenation and Literals SELECT fname + ‘ ‘ + lname AS name SELECT fname || ‘ ‘ || lname AS name

Built-In Functions Both SQL Server and Oracle have proprietary built-in functions: SQL ServerOracle Character char()chr() Null Test isnull(qty, 0)nvl(qty,0) Conditional Test CASE cust_type WHEN 1 THEN ‘Gold’ WHEN 2 THEN ‘Silver’ WHEN 3 THEN ‘Bronze’ END DECODE (cust_type, 1,’Gold’, 2,’Silver’, 3, ‘Bronze’) Oracle also has CASE

Data Type Conversion SQL Server uses the CONVERT function to convert data types. Replace with the appropriate Oracle equivalent function: SQL> SELECT TO_CHAR(sysdate) 2 FROM dual; SQL> SELECT CONVERT(char, GETDATE())

Comparing Oracle and SQL Server Stored procedures Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Stored Modules Oracle Stored Modules are coded in Java or PL/SQL They can either be PROCEDURES or FUNCTIONS They can be contained in PACKAGES

Stored Modules Most SQL Server Stored Modules are coded in Transact SQL. They can act as either procedures or functions. A set of modules can be coded under the same name using a numeric suffix to identify different modules.

Issues in Transact SQL Conversion Transaction Handling and Control Stored Sub Programs returning Resultsets Error Handling SQL Syntax Specific Built-in Functions Dynamic SQL Packaged Modules

Possible strategy to migrate Nested Transactions Define Global Variable “trancount” Initialize on first entry to a stored Sub Program to 1 Increment on each BEGIN TRANSACTION Decrement on each COMMIT If trancount = 0, do a commit to the database Savepoints can be used to provide rollback capability for nested transactions T-SQL issues - Transaction Handling Business Logic - Transact-SQL HandoutHandout

SQL Server / Sybase propagate errors back to client via global variable needs to be checked regulary Oracle has Exception Handling in PL/SQL to deal with errors Throw/Catch exception model SQL statements are embedded in a PL/SQL block with optional EXCEPTION section Use EXCEPTION to trap exactly the error conditions you wish Un-handled exceptions propagate to higher levels T-SQL issues - Error Handling Business Logic - Transact-SQL

DDL Statements Only allowed in PL/SQL through Dynamic SQL Removed and converted by the workbench Run outside of PL/SQL Stored Sub Program T-SQL issues – SQL Syntax Business Logic - Transact-SQL HandoutHandout

DML Statements Update / Delete from Resolved by Workbench Select List Subqueries Partly Resolved by Workbench Recode on complex cases ANSI Outer Joins are not an issue any more with Oracle9i T-SQL issues – SQL Syntax Business Logic - Transact-SQL HandoutHandout

Specific Functions Functions like REVERSE, CASE and more can partly be converted to their counterparts in Oracle Other Functions could be coded in PL/SQL, Java (8i) or via C Callouts BITWISE Operators Recode each bit with a separate column Or Use a stored function to simulate operators T-SQL issues – SQL Syntax Business Logic - Transact-SQL HandoutHandout

Dynamic PL/SQL is supported by Oracle TSQL Dynamic SQL calls converted to PL/SQL Dynamic SQL calls Code in TSQL variables is not converted by the workbench Oracle9i PL/SQL supports Dynamic SQL without DBMS_SQL T-SQL issues – Dynamic SQL Business Logic - Transact-SQL HandoutHandout

Identity columns Emulated by trigger + sequence Datetime Datatype to millisecond Is it really required ???? Use Oracle TIMESTAMP T-SQL issues – Miscellaneous Business Logic - Transact-SQL HandoutHandout

Packaged Modules Package modules must be renamed as individual stored modules. HandoutHandout

Comparing Oracle and SQL Server Triggers SQL ServerOracle Types of triggers INSERT, UPDATE, and DELETE statements INSERT, UPDATE, DELETE statements Occurrence AFTER and INSTEAD OF trigger BEFORE, AFTER and INSTEAD OF triggers OccurrenceStatement levelRow or statement level Reference to previous and new values Uses DELETED and INSERTED temporary tables Accessed via :OLD and :NEW

Comparing Oracle and SQL Server Utilities Main Differences: Organization Terminology Connection Models Transactional and Isolation Models Temporary Tables Application programming Stored Subprograms Utilities (Bulk Loading)

Differences in Utilities Oracle has scott/tiger schema = SQL Server PUBS database Oracle has System/manager = SQL Server SA/ Oracle Oracle Call Interface = SQL Server DB-Library/CT-Library Oracle SQL*Loader = SQL Server BCP Oracle Warehouse Builder = SQL Server Data Transformation Services (DTS) Oracle Advanced Queuing (AQ) = MSMQ

A Q & Q U E S T I O N S A N S W E R S