filling of datetime column SQL Server with the data in the date column oracle

After a lot of "finangling", I think I have my link dg4msql works well between Oracle and MSSQL.

Now, what I'm trying to do, is fill a table in MSSQL with an Oracle table column values, whenever a new row is inserted in the Oracle table. I use a very simple trigger on the oracle table that goes basically like this:

mware is dblink to MSSQL database, oracle col worth DATE and mssql col is of type DATETIME

This is the relaxation: (edited to show only the column in question)
==================================================================================
CREATE or replace TRIGGER < oracleowner >. INSERT_INTO_NVDB
AFTER INSERT ON < oracleowner >. < oracletable > for each row
BEGIN
insert into '< mssqlowner > '. «< mssqltable > @mware «»
(
"load_date_time,"
)
VALUES)
: new.loading_date,.
);

END;
==================================================================================

Now, when you enter a record in the Oracle trigger triggers ok table but does not insert a date in the MSSQL table, the 'load_date_time' in the mssql table can have NULL values so I guess there just inserts a null value.

When I activate the triggers on the table MSSQL, which then takes these values and inserts them into another table with values from other tables, inserting in the Oracle table fails because the relaxation on the MSSQL database tries to pass the date (which is empty) table MSSQL in another table where the datetime field is not null.

I guess it's because Oracle date format is not compatible with MSSQL, which I think is "yyyy-mm-dd hh: mm:"- so I have to either convert the date format by default Oracle to match a MSSQL, or convert a char of the trigger value. (The developer of the side MSSQL says if I can convert it to a char value that should be ok too)

I think that it is probably better to leave it in the date format, the best way to do this would be to put an "alter session set nls_date_format ="at the beginning of the trigger?

Can I convert the date to char the trigger easily? If there is a better way to proceed in the way I approach it I'm all for it.

Thank you!

Hello
Your best option is to explicitly convert dates Oracle in a format recognized by SQL * Server. It's more coding, but then you know exactly what is being inserted and you give more control, if anything changes. You can also code to handle null data.
I'm not sure than to try to change the format of date to 'alter session... ". "do what you want.
You can use "to_char" on a date into character data-

To_char (, "HH24:MI:SSxFF of MON-DD-YYYY")

and use any mask format supported.
You also use 'to_date' to transform the character data in a date format, as well as 'to_char' and 'to_date' in combination.
For example -.

SELECT TO_CHAR (TO_DATE (October 27, 98 ',' DD-MON-RR'), 'YYYY') 'Year' FROM DUAL;

This is all discussed in the documentation-

Oracle® database
SQL language reference
11g Release 2 (11.2)

where it also describes the different format masks.
If you need further assistance on the use of to_date, to_char formats then ask in the forum SQL/PLSQL.

SQL and PL/SQL

where they have more experience.

Kind regards
Mike

Tags: Database

Similar Questions

  • [4EA2] connecting to SQL Server with the second instance

    Connection to the early work of the Forum very well and I can choose the DB for this instance.

    There is a second instance... In the ODI driver, can I use this syntax

    JDBC:WebLogic:SQLServer://Server \instanceName_Reporting:1433

    I tried to enter the host name server\instanceName tab in SQL Server... It does not work... Does not the 3.2 Developer either.

    Any ideas?  I don't know what the custom jdbc url must be if I tried to use the Advanced tab.

    Found the answer

    In the port field enter

    1433/database; instance = second instance

    3.2 I did not change any how xml, it works as it is.

  • How can I connect to SQL Server with the Muse?

    I want to query items from database and load it to the front end. Is there a way that muse can connect to the sql server database?

    It is not yet possible for Muse. Muse only creates .html pages. Connection to a database would require some php or other scripting to bind the data. It is beyond the scope of Muse and I don't see what is happening for a while.

  • Windows 7 64 bit Pro connects to SQL Server on the Windows Server 2008 R2 Standard domain

    I put upgraded to Windows 7 Professional computers to Windows XP Professional, but I have a problem with getting one of software programs management of stock that allows us to connect to our SQL Server 2008 R2 Standard Windows on new Windows 7 computers.

    Our computers are connected to a domain, and therefore SQL Server. Computers Windows XP allows each user to standard domain to connect and to connect to SQL Server via the stock management software.

    But on the standard domain of Windows 7 Pro computer users unable to connect to SQL Server, but administrator accounts of area on the same Windows 7 Pro computers can connect to SQL Server through the inventory control program.

    I have set up the alias of the server, the server name and port number via the SQL Server Client Network utility ( cliconfg.exe ) so I know this isn't the problem because it works when I'm logged on as a domain administrator.

    There seems to be something to do with permissions of user domain and Windows 7 Pro. There seems to be a change from Windows XP Pro to Windows 7 Pro that does not allow standard domain users to connect to a SQL Server. But I can't find anything about and cannot practice how to solve this problem, except to make all users, domain administrators that is obviously not a good thing to do. So basically I think I need to create a group policy that allows users to connect to SQL Server, but I have no experience in doing this and don't know where to start.

    Thank you for all that you guys help and I hope someone can give me the solution to this problem.

    This issue is beyond the scope of this site and must be placed on Technet or MSDN

    http://social.technet.Microsoft.com/forums/en-us/home

    http://social.msdn.Microsoft.com/forums/en-us/home

  • Can I install SQL Server on the server vCenter?

    Is it possible to install SQL server on the vCenter server or the connection to the server...

    Due to limited memory problems, I have to make some adjustments with my setup to migrate.

    Thanks in advance.

    Hey Taher843,

    If your environment is small, you can install vCenter with SQL Express that comes with the installation of the vCenter server.

  • How do I click a button and have a fill in Firefox as I am with the specified text?

    I have support for a specific group of customers. I find myself repeatedly in writing almost the exact same paragraphs. What add-on would allow me to simply fill a field on a page with the exact text - I'm hoping to set up 20 or 30 replies I can just select instead of having to retype everything. Thanks for the tips.

    Try the cuts:

  • TCP on PC server with the network interface has 2

    If I need to create a TCP on PC server with the network interface has 2 with a different IP address, for example 192... and 172... and the IP address of the client side is 192..., is there something I need to take care.

    Any suggestion, thank you.

    No, by default the server listens on all interfaces.

  • SQL Server compact: the filemay of the damaged database.

    I get a Message at startup:

    An error occurred initializing SQL server compact: the filemay of the damaged database. The dataabase file may be damaged.  Run the repair utility to check the file daatabase.  [Database Name = \\?\\C:\program data\DDN;\Oasis2service\data\oasis2.sdf].

    Where can I find the repair utility?

    Hello

    Try asking in the Forums in SQL Server.

    Here is the Vista Forums.

    http://social.msdn.Microsoft.com/forums/en-us/category/SQLServer

    See you soon.

  • OBIEE retro-design to go from SQL Server to a data warehouse

    Hello
    I am new to modeling for data warehouses. We currently have an OBIEE environment put in place where the source of data was the transactional tables in SQL Server. The SQL Server data should be moved to a warehouse of data non-Oracle and I need to produce a logical data model for the people of my company warehouse. Unfortunately, the SQL Server data is never copied, so I based the model from the logical and physical of OBIEE diagram/relationships.
    My question is in what concerns the validity of the following relationships to be used in a data warehouse based on what is currently in OBIEE. When I have this model through Erwin, I wonder if I'm away from base in relationships (modeling, don't not personal):

    Dimension 1 has a 0:M with axis 2
    Dimension 1 has a 0:M with 3 Dimesion
    Dimension 2 has a 0:M with 3 Dimension
    Dimension 2 and 3 Dimension have a 0:M with 1 fact

    Through the use of pseudonyms and others, this works in OBIEE. Will this work as a model of data in a data warehouse environment?

    Thank you!

    I think that you started with the wrong foot. I suggest search you Google 'kimball methodology' and have a reading a few articles. Your DWH model should not be based on your transactional tables. You should ask your business users 'questions' they want to answer in the DWH. Then model your DWH base on it. You cannot model a DWH without knowing what questions you must answer. For example, if your users want to know the sales per day and per branch will be a fact of sales with a sales volume measure joining two dimension of branch and time dimensions. The number of facts will depend on the questions you need to answer, the data type, and the granularity of them.

  • SQL for SQL Server 2008 Developer Data Modeler

    I am not able to connect to my SQL Server 2008 since the SQL Developer Data Modeler. Although I jtds - 1.2.jar my machine and I can connect SQL server through the SQL Developer, but still I am not able to connect through the Data Modeler. I need to rethink and to generate the data model for some existing patterns.

    Here's what I'm following: -.

    File Data-> shape-> import-> data dictionary-> add-> new JDBC, ODBC Bridge connection-> other third-party driver

    now when I give driver and the JDBC URL, it throws an error message indicating that the driver is not found.

    Please let me know what I can do to fix this problem, any help would be appreciated.

    Kind regards
    AVA

    I would try 1 to connect to the db of sqldeveloper (by jtds - uninvolved to ODBC) and see if you can browse your sql db queries and question in a worksheet. Export this connection to xml format, and then import that Modeler.

  • How can I use SQL to check the Version of Oracle Forms and object of the request?

    Hi all:

    How can I use SQL to check the Version of Oracle Forms and object of the request?





    Concerning
    Terry

    Terry,

    See the following threads/docs for the version of forms.

    How to find the developer version
    Re: How to find the developer version

    Note: 466890.1 - Script to find the Apache, Java, Jinitiator, version of forms and details of the JVM for Oracle E-Business Suite 11i
    Note: 392793.1 - how to get Forms Oracle Oracle Applications 11i Command Line Version
    Note: 468311.1 - Script to find the Apache, Java, JRE, Forms for Oracle E-Business Suite R12 version

    What purpose are you talking?

    Thank you
    Hussein

  • Change my Win 2008 and SQL Server on the server with SATA drives to the server with SAS disks

    I need to change my disks on my HP Server. Disco SATA Raid 1, I have to pass it to a server with SAS disks

    I haver Windows 2008 Server 64-bit installed SQL

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited to the audience on MSDN. Please post your question in the below link:

    http://social.msdn.Microsoft.com/forums/en/category/SQLServer

  • With the help of Oracle heterogeneous access table to sql server database services

    I created a dblink "POC_HS" of oracle to sql (heterogeneous services implemented) and I can't go out data from the default database to which the DSN (for sql server) is connected successfully.

    So, this ' select * from ' Test@POC_HS is works perfectly well on the Oracle database as 'Test' table resides in the default database (that the system DSN is connected to).

    But when I do ' select * Abc.Test@POC_HS' where the Test table resides in the 'ABC' database which is not the default survey database an error as follows:

    ORA-00942: table or view does not exist the name of incorrect [generic object using ODBC Connectivity] [Microsoft] [ODBC SQL Server driver] [SQL Server] 'Abc.Test '. [Microsoft] [ODBC SQL Server driver] [SQL Server] Instructions could not be prepared. (SQL State: S0002;) SQL code: 208)

    I also tried "select * from Abc.dbo.Test@POC_HS' but oracle throws this exception" ORA-00933: not correctly completed SQL command "."

    The dblink and system DSN user account has access to database 'Abc '.

    Thoughts?

    No, this is not possible.

  • Exit SQL - compare with the files under unix

    Dear Experts,

    I'm putting in place an alert mechanism for the RAC load balancing.

    I'm running a SQL to see what services RAC instances are currently underway and need to compare this result with a text file on the unix server. If my SQL query shows the services that are running on different instances of that text file, I need to send a warning. For example, SQL result shows * 'db1_obj_lock' runs on 2nd instance * where as text shows file must be run on the 1st instance, I need this to be reported.

    I am developing a shell script to do this and need help with your entries. I understand that it's more issue of UNIX, but thought SQL experts might be able to help as they have treated these scenarios. Appreciate your help.
    SELECT INST_ID,NAME from gv$active_services where
    name in ('db1_obj_lock','db1_app_ro1','db1_app_ro2')
    order by name
    /
    
       INST_ID NAME
    ---------- ----------------------------------------------------------------
             2 db1_obj_lock
             5 db1_app_ro1
             6 db1_app_ro1
             6 db1_app_ro2
             5 db1_app_ro2
    
    srv1:/tmp# cat services.txt (This shows service names and instances they are running on)
    
    db1_jdbc     4
    db1_obj_lock 1
    db1_app_ro1  5
    db1_app_ro1  6
    db1_app_ro2  5
    db1_app_ro2  6
    db1_rpt      1
    db1_rpt      2
    db1_rpt      3
    db1_rpt      4
    .
    .
    .
    etc

    ORA, DBA wrote:
    I think I do something wrong during the creation of the external table:

    Please see below create table statement and my select * stmt. Select * null values returns INST_ID select, when I select INST_ID select db1_serv_external, all I get is null values. Is there a clause that miss me in create stmt this column values correctly from external table file OS maps? Appreciate your help

    SQL> create table db1_serv_external
    2      (name char(18),
    inst_id number(2))
    3    4       ORGANIZATION EXTERNAL
    5       (TYPE ORACLE_LOADER
    6     DEFAULT DIRECTORY db1_serv_ext
    7      ACCESS PARAMETERS
    8        (RECORDS DELIMITED BY NEWLINE
    9     FIELDS (name char(18),
    10           inst_id integer(2)))
    11    LOCATION('db1_svc.lst'));
    
    Table created.
    
    SQL> select * from db1_serv_external;
    
    NAME                  INST_ID
    ------------------ ----------
    db1_jdbc      4
    db1_jdbc      1
    db1_jdbc      2
    db1_jdbc      3
    db1_obj_lock  1
    

    db1_obj_lock 1
    123456789012
    It seems that the longer 'NAME' is only 11 characters; No 18

  • Loading data to SQL server for the Oracle database

    I want to create a table in oracle db table in sql server. Table is huge that he has obtained the documents 97,456,789.
    I created the link (HS) db in the oracle database that points to the sql server. I choose this oracle db on the link table.

    Select * from 'dbo '. "T1@dblink;

    I shot below to create the table.
    create table t2 nologging parallel (degree = 3) as select * from 'dbo '. "T1@dblink;
    and its taking a long time... but its operation...

    is there any other method to do this and and fill the table in oracle db faster.

    Please notify. Thank you.

    vhiware wrote:
    create table t2 nologging parallel (degree = 3) as select * from 'dbo '. "T1@dblink;
    and its taking a long time... but its operation...

    I doubt that parallel processing will be used because it is unique to Oracle (using rowid varies in general) and not SQL-Server.

    is there any other method to do this and and fill the table in oracle db faster.

    Part of the performance overhead is to pull that data from SQL Server to Oracle in the whole of the liaison network between them. This can be accelerated by compressing the data first - and who then transfer them over the network.

    For example: using + bcp + to export the data in the SQL Server box to a CSV file, compress/zip file, scp/sftp file Oracle and then to unzip there. In parallel and direct treatment of load can now be done using SQL * Loader to load the CSV file into Oracle.

    If it is a basic Linux/Unix system, the process of decompression/unzip can be run in parallel with the SQL * process Loader by creating a pipe between the two – where the decompression process writes data uncompressed in the pipe and SQL * Loader reads and loads the data that is available through the pipe.

    Otherwise you are PQ own transformation. Assume that the data is date varies. You can create a procedure on Oracle that looks like this:
    {code}
    create or replace procedure as copyday (day) is
    Start
    Insert / * + append * / into local_tab select * from remote_tab@remotedb where col_day = day;
    -Add logging info, validation, etc.
    end;
    {code}

    You can now start 10 or more of these different days and run it in the background using DBMS_JOB.

Maybe you are looking for

  • SOS emergency app

    Hello I'm looking for an emergency sos app for my iphone, which allows you to access it and alert help by pressing the power button. (Edge of Samsung Galaxy has a built) All applications that I found, will leave you only access it by going to your ap

  • Satellite L300-1AS does not load

    Hello My laptop has stopped to load the other day, it should Flash it then recharges after that I have nothing! I tried pushing it with a little force it should blink. But now, nothing happens. It's very frustrating. The power supply had been pressed

  • Win 10 guard reboot

    Just bought a new imac end of 2015 with 1 TB disk fusion and installed windows via bootcamp 10 6 but it cancels to randomly just a black screen, followed by the apple chime. I tried to reinstall several times, sometimes it will be the same when insta

  • Full range of pulse width measurement

    Hello I'm having a problem with the measurement of PW, I need to read an operating cycle within a range of 0% to 100%.  The problem I have is the signal does not cross the Middle time enough baseline to measure or the histogram cannot be used because

  • Windows xp will not recognize or list the wireless connection.

    Original title: we changed wireless routers and now windows xp will be same not recognize or the same list if wireless connection 3 computers in the House will be Under networkconnections the old wireless router, or the other is visible.   I tried to