Recreating SQL Server Tables on Oracle
Hello,
I need to recreate several SQL Server tables in Oracle and am trying to figure out if there is an easier way to do it other than manually recreating them.
I have the SQL Server table scripts, and I have data load xls files that also contain the column names. I use TOAD for Oracle to do my database management, but there is currently no way to autmoatically create a table based on an external file.
Does anyone have any suggestions?
Thanks,
Christine
Manually re-creating these SQL Server tables for Oracle is exactly the right thing to do.
SQL Server != Oracle
In other words, there are numerous differences. You need to look at each table and decide on the type of table (hash table, index organised table, partitioned tables), whether to cluster tables, the types of indexes to use, the data types for the columns to use (Oracle does not have boolean or auto incrementing data types). Oracle supports LONG, RAW, CLOB and BLOB for dealing with different types of binary and large data structures. LONG for example should not be used anymore. There are also specialised data types like BFILE. One can also define your own SQL data types.
You will only be doing yourself a favour, and the final database application, by going through the learning curve and manually converting each and every table. And no, it is not a huge task either. It sounds a lot more daunting that what it really is.
Similar Messages
-
How to insert into SQL server table form oracle forms
I created a form with oracle as my database. But there one trigger where I need to insert the data into a sql server table.
Is this possible. If so can any help me out.
Thanks in advance.
AshaHi,
You can insert into sql server database using the following steps
Note: Check wether you are using Forms 32 bit drivers. If not the Odbc data source will not work.
step 1: Create ODBC data source for SQL server(one time creation);
step 2: Logout from Oracle and login to SQL server giving the user name,password and host string as odbc:<odbc datasource name>;
step 3: use EXEC SQL statement to insert the values into the SQL server and then logout and login again to your oracle database.
Second Method.
Check the sql server documentation to insert the values using command line parameters. Then you can call the host command to execute this.
Third Method.
Write a VB exe to enter the values in the sql server making two connections one to oracle another to SQL server and then getting values from Oracle and putting in the SQL server database. You can call this exe using the Host command.
Hope this will help You.
Regards
Gaurav Thakur -
Querying SQL server table from Oracle database 11g
Hi all
We are using oracle database 11g R2 on REL 5 and i have an SQL server database used by one of our application.
In my Oracle database, i want to query one table in my SQL server database and to link it in a table in Oracle database to compare data.
Is there a way like database link or something else to do this need>
Please send a link or pots here step by step the way on how to accomplish my query.
Thank you.Yes, you can set up your SQL Server as an external database link, using Oracle Heterogeneous Services with SQL Server as an ODBC connection (easier to do if your Oracle server is a Windows server, a little more tricky if your Oracle server is *nix based)
Here's the documentation... for 11gR2
http://www.oracle.com/pls/db112/search?remark=quick_search&word=heterogeneous+services -
Read SQL Server table from Oracle
Hi,
Oracle 11.2.0.1
Windows XP Prof Edition
After creating DSN name opd when I tried to connect sql server Enterprise Edition 2005 database on the same PC, I failed to establish connectivity.
Here it is what I have and done :
C:\Documents and Settings\Administrator>type %oracle_home%\network\admin\listener.ora
# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM=extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
(SID_DESC=
(SID_NAME = opd)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = dg4odbc)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = newserver4)(PORT = 1521))
ADR_BASE_LISTENER = C:\app\Administrator
C:\Documents and Settings\Administrator>type %oracle_home%\network\admin\tnsnames.ora
# tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = newserver4)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
opd =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=newserver4)
(PORT=1521)
(CONNECT_DATA=(SID=opd))
(HS=OK)
C:\Documents and Settings\Administrator>type %oracle_home%\network\admin\sqlnet.ora
# sqlnet.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
C:\Documents and Settings\Administrator>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.1.0 - Production on 31-DEC-2013 18:26:13
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.1.0 - Production
Start Date 31-DEC-2013 18:05:31
Uptime 0 days 0 hr. 20 min. 43 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\listener.ora
Listener Log File c:\app\administrator\diag\tnslsnr\newserver4\listener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=newserver4)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "opd" has 1 instance(s).
Instance "opd", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
C:\Documents and Settings\Administrator>tnsping opd
TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 31-DEC-2013 18:26:29
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\app\Administrator\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=TCP) (HOST=newserver4) (PORT=1521))) (CONNECT_DATA=(SID=opd)) (HS=OK))
OK (40 msec)
C:\Documents and Settings\Administrator>type %oracle_home%\hs\admin\initopd.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = opd
HS_FDS_TRACE_LEVEL = off
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
C:\Documents and Settings\Administrator>sqlplus scott/tiger
SQL*Plus: Release 11.2.0.1.0 Production on Tue Dec 31 18:27:18 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop database link opd;
Database link dropped.
SQL> create database link opd connect to "sa" identified by "girish" using 'opd';
Database link created.
SQL> select count(*) from ny@opd;
select count(*) from ny@opd
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified {IM002}
ORA-02063: preceding 2 lines from OPD
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
C:\Documents and Settings\Administrator>
PS : I don't know why I am not able to see my above question on Heterogeneous Connectivity forum, while the thread has been generated :https://community.oracle.com/thread/2616787
Thanks and Regards
Girish SharmaThanks Sb.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> drop database link opd;
Database link dropped.
SQL> create database link opd connect to "SA" identified by "girish" using 'opd';
Database link created.
SQL> select count(*) from ny@opd;
select count(*) from ny@opd
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified {IM002}
ORA-02063: preceding 2 lines from OPD
Regards
Girish Sharma -
I'm converting SQL Server Tables to Oracle using MWB 9.2. The tables contain images (data type "image"). I get the following error from the MWB generated scripts:
SQL*Loader-309: No SQL string allowed as part of DISPLAY_IMAGE field specification
The column definition in the .ctl file is:
DISPLAY_IMAGE NEXT ***** CHARACTER
Maximum field length is 2000000
Terminator string : '<ec>'
SQL string for column : "HEXTORAW (:DISPLAY_IMAGE)"Kelly,
The OMWB only supports inline data transfer of image types to LONG RAW via SQL*Loader.
You should be ablr to use TO_LOB() to convert the LONG to LOB.
The error you have is what you get when you try yo migrate to BLOB. TO use SQL*Loader
with BLOB you would need to have unload each image into a seperate file and the OMWB
doen't help you do this. bcp dumps the image data in hex (hence the HEXTORAW sql function),
I don't know how bcp would dump this as binary.
Jim. -
I am trying to have access tables of the Sql Server through the Oracle
I am trying to have access tables of the Sql Server through the Oracle and this being occurred the error:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
I created the ODBC with name HSMSQL.
I made all the configurations in the archives
tnsnames.ora:
HSMSQL=
(DESCRIPTION=
(ADDRESS= (PROTOCOL = tcp)(HOST = wsus)(PORT = 1521))
(CONNECT_DATA =
(SID = HSMSQL)
(HS = OK)
listener.ora:
(SID_DESC = (SID_NAME=HSMSQL)
(ORACLE_HOME= C:\oracle\ora92)
(PROGRAM =hsodbc)
initHS_SID.ora:
HS_FDS_CONNECT_INFO = HSMSQL
HS_FDS_TRACE_LEVEL = OFF
-- Create database link
create database link HSMSQL.US.ORACLE.COM
connect to TESTE identified by TESTE2
using 'HSMSQL';
But when I execute query the error occurs:
Select * from TabTeste@HSMSQL
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
Please they help me, thanks, Paulo.Hi,
It seems that your configuration is Ok. By the way, the workaround for this error is:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for ODBC][H001] The environment variable <HS_FDS_CONNECT_INFO> is not set.
* Set HS_FDS_CONNECT_INFO in the hs{sid}init.ora file to the data source name.
Example: HS_FDS_CONNECT_INFO = <ODBC DataSource Name>
* Make sure the hs{sid}init.ora file exists in the ORACLE_HOME/hs/admin directory and has the same name as the SID in the LISTENER.ORA.
Example: If SID=hsodbc in the listener.ora file, then the hs{sid}init.ora file would be named ORACLE_HOME/hs/admin/inithsodbc.ora
For more information see if this [url http://forums.oracle.com/forums/thread.jspa?forumID=61&threadID=576975]thread can help you.
Cheers -
ORA-02070: Error when updating a SQL Server table thru an Oracle View
I have a SQL Server table TIMESHEET which contains a number of VARCHAR and NUMERIC columns plus a DATETIME column.
Only the DATETIME column is giving me trouble.
On the ORACLE side I have a view which selects from the SQL Server table but in order to get the SELECT to work, I had to either put a CAST or TO_DATE function call around the DATETIME field
Below is the relevant part of the 2 view definitions I have tried
create view TIMESHEET as
SELECT
"TsKeySeq" as TS_KEY_SEQ,
"EmployeeNo" as EMPLOYEE_NO,
CAST("PeriodEnding" AS DATE) as PERIOD_ENDING,
. . . (more columns - not relevant)
FROM [email protected];
An update to the view generates this message
ORA-02070: database OLEMSQLPSANTDAS6 does not support CAST in this context
create view TIMESHEET as
SELECT
"TsKeySeq" as TS_KEY_SEQ,
"EmployeeNo" as EMPLOYEE_NO,
TO_DATE("PeriodEnding") as PERIOD_ENDING,
. . . (more columns - not relevant)
FROM [email protected];
An update to the view generates this message
ORA-02070: database OLEMSQLPSANTDAS6 does not support TO_DATE in this context
If I don't include either the TO_DATE() or CAST() then I get
Select Error: ORA-28527: Heterogeneous Services datatype mapping error
ORA-02063:preceding line from OLEMSQLSANTDAS6
Does anyone have any idea how to update a SQL Server DATETIME column thru an ORACLE view?You can't cast accross heterogenious databases and there is no need to. HSODBC treats SQL Server DATETIME column as DATE. For example, I have SQL Server table:
CREATE TABLE [Ops].[T_JobType](
[JobType] [varchar](50) NOT NULL,
[JobDesc] [varchar](200) NULL,
[InsertDt] [datetime] NOT NULL CONSTRAINT [InsertDt_00000006] DEFAULT (getdate()),
[InsertBy] [varchar](128) NOT NULL CONSTRAINT [InsertBy_00000006] DEFAULT (user_name()),
[LastUpdated] [datetime] NOT NULL CONSTRAINT [LastUpdated_00000006] DEFAULT (getdate()),
[LastUpdatedBy] [varchar](128) NOT NULL CONSTRAINT [LastUpdatedBy_00000006] DEFAULT (user_name()),
CONSTRAINT [T_JobType_PK] PRIMARY KEY CLUSTERED
[JobType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [DATA01FG]
) ON [DATA01FG]Now on Oracle side I do:
SQL> desc "Ops"."T_JobType"@pbods
Name Null? Type
JobType NOT NULL VARCHAR2(50)
JobDesc VARCHAR2(200)
InsertDt NOT NULL DATE
InsertBy NOT NULL VARCHAR2(128)
LastUpdated NOT NULL DATE
LastUpdatedBy NOT NULL VARCHAR2(128)
SQL> select "InsertDt" from "Ops"."T_JobType"@pbods;
InsertDt
18-AUG-08
09-OCT-08
22-OCT-09
18-AUG-08
19-NOV-08
SQL> SY. -
Writing a stored procedure to import SQL Server table data into a Oracle table
Hello,
As a new DBA I have been tasked with writing a stored procedure to import SQL Server table data into an Oracle table. I have been given many suggestions on how to do it from SQL Server but I I just need to write a stored procedure to run it from the Oracle side. Suggestions/guidance on where to start would be greatly appreciated! Thank you!
I started to write it based on what I have but I know this is not correct :/
# Here is the select statement for the data source in SQL Server...
SELECT COMPANY
,CUSTOMER
,TRANS_TYPE
,INVOICE
,TRANS_DATE
,STATUS
,TRAN_AMT
,CREDIT_AMT
,APPLD_AMT
,ADJ_AMT
,TRANS_USER1
,PROCESS_LEVEL
,DESCRIPTION
,DUE_DATE
,OUR_DATE
,OUR_TIME
,PROCESS_FLAG
,ERROR_DESCRIPTION
FROM data_source_table_name
#It loads data into the table in Oracle....
Insert into oracle_destination_table_name (
COMPANY,
CUSTOMER,
TRANS_TYPE,
INVOICE,
TRANS_DATE,
STATUS,
TRANS_AMT,
CREDIT_AMT,
APPLD_AMT,
ADJ_AMT,
TRANS_USER1,
PROCESS_LEVEL,
DESCRIPTION,
DUE_DATE,
OUR_DATE,
OUR_TIME,
PROCESS_FLAG,
ERROR_DESCRIPTION)
END;CREATE TABLE statements would have been better as MS-SQL and Oracle don't have the same data types.
OUR_DATE, OUR_TIME will (most likely) be ONE column in Oracle.
DATABASE LINK
Personally, I'd just load the data over a database link:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_table@mssql_db_link
As far as creating the database link from Oracle to MS-SQL ... that is for somebody else to answer.
(most likely you'll need to use an ODBC driver)
EXTERNAL TABLE
If the data from MS-SQL is in a CSV file, just use and external table.
same concept:
insert into oracle_destination_table_name ( <column list> )
select ... <transform data here>
from data_source_external_table
MK -
Oracle query on dblinked SQL Server tables returns ORA-00904 error
Hi,
I have created a dblink to a SQL Server database from Oracle using Generic Connectivity.
The following query returns ORA-00904 Invalid Identifier error in the WHERE clause (tblEmp.Empno)
SELECT "EmpNo","EmpName", "DeptName"
FROM tblEmp@sqlserver,
tblDept@sqlserver
WHERE tblDept.DeptNo = tblEmp.Empno
I had to enclose the column names in double quotes due to case sensitivitiy of the columns, but I can't do the
same for the WHERE clause.
1) So, how do I fix this error ?
2) Also how do I include Deptno column with table alias in the columns list?
(Deptno is ambiguous in Emp and Dept tables)
Regards,
SamAlex
Because using the aliases all the time can become annoying and lead to disparate standards when used by multiple developers. For a one-off query I would go with aliases in the query but if the linked tables are going to be interrogated extensively I would prefer to create vanilla views of the underlying tables so that the aliases aren't necessary.
Just my opinion, it feels a bit cleaner to do it this way - you only do the work once in creating the view and then you don't need to worry about the case sensitivity of the linked database. You can also refer to the source in the name of the view so you don't have to think about different source databases with the same table names.
Cheers
Ben -
Oracle equivalent to SQL Server Table Variables ?
Does Oracle have anything equivalent to SQL Server table variables, that can be used in the JOIN clause of a select statement ?
What I want to do is execute a query to retrieve a two-column result, into some form of temporary storage (a collection ?), and then re-use that common data in many other queries inside a PL/SQL block. I could use temporary tables, but I'd like to avoid having to create new tables in the database, if possible. If I was doing this in SQL Server, I could use a table variable to do this, but is there anything similar in Oracle ? SQL Server example:
use Northwind
DECLARE @myVar TABLE(CustomerID nchar(5), CompanyName nvarchar(40))
INSERT INTO @myVar(CustomerID, CompanyName)
select CustomerID, CompanyName
from Customers
--Join the variable onto a table in the database
SELECT *
FROM @myVar mv join Customers
on mv.CompanyName = Customers.CompanyName
The closest I've found in Oracle is to use CREATE TYPE to create new types in the database, and use TABLE and CAST to convert the collection to a table, as shown below. I can't see anyway without creating new types in the database.
CREATE TYPE IDMap_obj AS Object(OldID number(15), NewID number(15));
CREATE TYPE IDMap_TAB IS TABLE OF IDMap_obj;
DECLARE
v_Count Number(10) := 0;
--Initialize empty collection
SourceIDMap IDMap_TAB := IDMap_TAB();
BEGIN
--Populate our SourceIDMap variable (dummy select statement for now).
FOR cur_row IN (select ID As OldID, ID + 10000000 As NewID From SomeTable) LOOP
SourceIDMap.extend;
SourceIDMap(SourceIDMap.Last) := IDMap_obj(cur_row.OldId, cur_row.NewId);
END LOOP;
--Print out contents of collection
FOR cur_row IN 1 .. SourceIDMap.Count LOOP
DBMS_OUTPUT.put_line(SourceIDMap(cur_row).OldId || ' ' || SourceIDMap(cur_row).NewId);
END LOOP;
--OK, can we now use our collection in a JOIN statement ?
SELECT COUNT(SM.NewID)
INTO v_Count
FROM SomeTable ST JOIN
TABLE(CAST(SourceIDMap As IDMap_TAB)) SM
ON ST.ID = SM.OldID;
DBMS_OUTPUT.put_line(' ' );
DBMS_OUTPUT.put_line('v_Count is ' || v_Count);
END;Hi, got this from our plsql guys:
The term "table function" is a bit confusing here. In Oracle-speak, it means a function that can be used in the from list of a select statement thus:
select * from Table(My_Table_Function()),..
where...
The function's return type must be a collection that SQL understands. So for the interesting case -- mimicking a function with more than one column -- this would be a nested table of ADTs where both the ADT and the nested table are defined at schema level. PL/SQL -- by virtue of some clever footwork -- allows you to declare the type as a nested table of records where both these types are declared in a package spec. This alternative is generally preferred, especially because the nested table can be of Some_Table%rowtype (or Some_Cursor%rowtype if you prefer).
As I understand it from our man on the ANSI committee, our use terminology follows the standard.
The construct below seems to be a bit different (though there are similarities) because it appears from your code sample that it's usable only within procedural code. And the object from which you select is a variable rather than a function.
So, after that preamble... the answer would be:
No, we don't have any constructs to let you "declare" something that looks like a regular schema-level table as a PL/SQL variable -- and then use (static) SQL on it just as if it were a schema-level table.
But yes, you can use PL/SQL's pipelined table function to achieve much of the same effect.
Look at the attached Table_Function.sql.
It shows that you can populate a collection of records using ordinary PL/SQL code. You can't use SQL for insert, update, or delete on such a collection. I see that SQL Server lets you do
insert into Program_Variable_Table select... from Schema_Level_Table
The PL/SQL equivalent would be
select...
bulk collect into Program_Variable_Collection
from Schema_Level_Table
The attached shows that once you have populated your collection, then you can then query it with regular SQL -- both from inside PL/SQL code and from naked SQL.
and the code is here
CONNECT System/p
-- Drop and re-create "ordinary" user Usr
EXECUTE d.u
CONNECT Usr/p
create table Schema_Things(ID number, Description Varchar2(80))
create package Pkg is
subtype Thing_t is Schema_Things%rowtype;
type Things_t is table of Thing_t; -- index by pls_integer
Things Things_t;
-- PLS-00630: pipelined functions must have
-- a supported collection return type
-- for "type Things_t is table of Thing_t index by pls_integer".
function Computed_Things return Things_t pipelined;
procedure Insert_Schema_Things(No_Of_Rows in pls_integer);
end Pkg;
create package body Pkg is
function Computed_Things return Things_t pipelined is
Idx pls_integer;
Thing Thing_t;
begin
Idx := Things.First();
while Idx is not null loop
pipe row (Things(Idx));
Idx := Things.Next(Idx);
end loop;
end Computed_Things;
procedure Insert_Schema_Things(No_Of_Rows in pls_integer) is
begin
Things := Things_t();
Things.Extend(No_Of_Rows);
for j in 1..No_Of_Rows loop
Things(j).ID := j;
Things(j).Description := To_Char(j, '00009');
end loop;
insert into Schema_Things
select * from Table(Pkg.Computed_Things());
end Insert_Schema_Things;
end Pkg;
-- Test 1.
begin Pkg.Insert_Schema_Things(100); end;
select * from Schema_Things
-- Test 2.
begin
Pkg.Things := Pkg.Things_t();
Pkg.Things.Extend(20);
for j in 1..20 loop
Pkg.Things(j).ID := j;
Pkg.Things(j).Description := To_Char(j, '00009');
end loop;
for j in 1..5 loop
Pkg.Things.Delete(5 +2*j);
end loop;
end;
select * from Table(Pkg.Computed_Things())
/ -
Developing database views between Oracle and SQL Server tables
I am on Oracle 10.2, my organization has many SQL Server databases as well and has now made
SQL server as company standard so many new databases will be developed in SQL Server. It is of course
not possible to convert all Oracle databases to SQL Server, so a mix environment will exist. Two questions:
1. Is it possible to develop database views in Oracle (10g in my case) which join Oracle tables with tables in SQL Server 2008? If yes, how. I have seen some heterogeneous connectivity setup to connect SQL Server to Oracle, but not sure whether it is possible to develop a database view across two databases.
2. I know it is not a SQL Server forum, but many DBA’s know both Oracle and SQL Server. Is it possible to develop views in SQL Server (SQL Server 2008 R2 in my case) which join Oracle 10g and SQL Server 2008 tables? I know in SQL Server, there is way to set up linked servers, but do not know whether it is possible to develop views.
Thanks a lot for your insight.You can create views that join local Oracle tables and remote SQL Server tables. I'm pretty sure you can do the reverse as well but I haven't personally done it.
However, I would be very concerned about the performance you'd get if you created that sort of view. You'd very frequently end up in a situation where Oracle has to pull all the data in the remote table across the database link in order to apply predicates and join the data locally. That could be disastrous from a performance standpoint.
Justin -
How to provide joins between oracle tables and sql server tables
Hi,
I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server.
how to provide joins between oracle tables and sql server tables ? Any help on this
Regards,
Malliuser10675696 wrote:
I have a requirement that i need to generate a report form two different data base. i.e Oracle and Sql Server. Bad idea most times. Heterogeneous joins do not exactly scale and performance can be severely degraded by network speed and b/w availability. And there is nothing you can do in the application and database layers to address performance issue at the network level in this case - your code's performance is simply at the mercy of network performance. With a single glaring fact - network performance is continually degrading. All the time. Always. Until it is upgraded. When the performance degradation starts all over again.
If the tables are not small (few 1000 rows each) and row volumes static, I would not consider doing a heterogeneous join. Instead I would rather go for a materialised view on the Oracle side, use a proper table and index structure, and do a local database join. -
Migrate tables from Ms SQL Server 20005 to Oracle 10g
Hi all,
I am trying to migrate 10 table from Ms SQL Server 2005 to Oracle 10g. I started creating a SSIS package to transfer them but it always fail when it tries to create the tables.
Questions:
- Is there any other way to import Ms SQL Server 2005 tables to Oracle
- also I need to create a scirp that will update these tables periodically
any ideas?
ThanksYingKuan is right. jsut to expound a little further. This will also allow you to have have scripts which you can run again and again or even schedule them regularly too.
B -
Can a SQL SERVER table be accessed via Oracle Forms
My boss asked me this question today. I am pretty sure the answer is "no", but thought it better to throw it out to the crowd:
"Can a SQL SERVER table be accessed via Oracle Forms?"Yes, this is possible using Oracle's Transparent Gateway. Check out the My Oracle Support (formerly Metalink) document "How To Create A Form Based on SQL Server Table" (Doc ID: 564915.1) for all of the details. This document is based on Forms 10g (10.1.2.0.2) so you may need to upgrade your Forms version if you are not already at this version at a minimum.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Export data from MS sql server table to an oracle table
I need to move data from a sql server table to an oracle table and when ever the sql server table is updated it needs to automatically update the oracle table. Is there procedure to do this or do I migrate the data once and set up a trigger on the sql server table to update the oracle table? If the trigger is the answer how do I do that?
You might want to check out Oracle's heterogeneous services functionality if you haven't done so already. Here are a few links:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/toc.htm
http://download.oracle.com/docs/cd/B19306_01/server.102/b14232/majfeat.htm#sthref74
Also, consulting the Oracle streams manual may be helpful -- particularly Chapter 5.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14228/toc.htm
Perhaps someone who is more familiar with SQL Server could provide a more helpful answer.
Maybe you are looking for
-
Can't get Palm Desktop app to react after syncing with Yahoo mail calendar info
Attempted to move calendar from Yahoo mail page to Palm Desktop in my Macbook-- Yahoo page says "don't use Intellisync" --thre is a new program called Autosync--but it turns out it doesn't work for Macs --clearly, many instructions on Yahoo paged do
-
I have now returned my second Micro (due to hard dri've locking up after owning it for 2 weeks) and am getting an Ipod Nano tonight. Just too many issues discussed on here with the Micro's durability. I've enjoyed reading this board. Hope you all hav
-
Equium P200-178: 17" lcd screen has gone funny colours
My 17" screen on my equium p200-178 has gone funny colours as if when looking at any pictures there is far to much saturation on the screen. I have plugged in an external monitor and that screen works fine. So i am going th have to change the screen.
-
Oracle property path and arq property functions
Hi, I am using Oracle Jena Adapter. My problem is about property paths on Sparql queries. When I tried to query "SELECT * WHERE { ?t rdf:type owl:ObjectProperty. ?t rdfs:domain ?o. ?o owl:unionOf ?union. ?union rdf:rest*/rdf:first ?member. }" from Mo
-
Does a Signature Field Have a Signature?
I have a form with 2 signature fields. I want to make sure that the first Signature Field has a signature in it before the second can be entered. I think I would use a script in the Pre-Sign event, but I don't know what property to check, or what e