473,763 Members | 4,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Oracle Trigger through C# Web service

Hello Everyone
I have to create Oracle tables in my application on the
fly, which have an Autonumber field. So, everytime I
create a table, I have to create a corresponding sequence
and trigger for the table. Let's consider the following
simple example:

-------------------
create table testTable(id NUMBER(10) PRIMARY KEY, name
VARCHAR(20));

create SEQUENCE testTable_seq;

create or replace TRIGGER testTable_trig
before insert on testTable
for each row
begin
select testTable_seq.n extval
into :new.id from dual;
end;
/
------------------
The problem I'm facing is while creating the trigger. It
seems like the "/" at the end of the trigger always needs
to typed after pressing a return. Now I'm not able to
give this return character through my C# code. The ways
in which I have tried it are:

------------------
string trigger = "create or replace TRIGGER
testTable_trig before insert on testTable for each row
begin select testTable_seq.n extval into :new.id from
dual; end; " + "0x0d" + "/";

OleDbCommand myTrigger = new OleDbCommand(tr igger,
myConnection);

myTrigger.Execu teNonQuery();

AND

string trigger11 = "create or replace TRIGGER
testTable_trig before insert on testTable for each row
begin select testTable_seq.n extval into :new.id from
dual; end; "

string trigger12 = "/";

OleDbCommand myTrigger11 = new OleDbCommand(tr igger11,
myConnection);
OleDbCommand myTrigger12 = new OleDbCommand(tr igger12,
myConnection);

myTrigger11.Exe cuteNonQuery();
myTrigger12.Exe cuteNonQuery();
----------------------
Both the methods seem very stupid and as expected, don't
work :).

Can someone please help me with this problem?

Regards
-yogesh

Nov 18 '05 #1
0 2042

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
13062
by: Shashikant Khandelwak | last post by:
Hi ! I am trying to install oracle 9i Standard edition on a windows 2000 SP4 machine. I get through the entire installation up to running the Database Configuration Assistant. While it tries to make the database, it gets to the "Creating and starting Oracle instance" stage, and then the errors start. I get: ORA-01503: CREATE CONTROLFILE failed. ORA-00205: error in identifying control file. check alertlog for more
2
2406
by: David | last post by:
Dear All, I want to execute and create the same trigger for all users. How can the oracle auto execute that or how can I create a trigger for all users ? Thanks. Best Regards, David
9
11233
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has only one column: txtOutput I want to use the DB front end (MS Access) to send the text string to the SQL backend, then have the SQL Server create a file to a path, such as F:/myfiledate.txt that holds the text in txtOutput, then the trigger...
1
17342
by: efinney | last post by:
Hi, I'm a newbie to sql server and this may be a really dumb question for some you. I'm trying to find some examples of sql server triggers that will set columns (e.g. the created and modified date columns) if the row is being inserted and set a column (e.g. just the modified date column) if the row is being updated. I know how to do this in oracle plsql. I would define it as a before insert or update trigger and reference old and new...
4
2009
by: golu | last post by:
Has any body done the porting from oracle to sql server, what were the issues in porting the data bases? Also suggest some resources which can be helpful in the porting project TIA Golu
4
3986
by: Abram Friesen | last post by:
Hi, I'm a developer for a software application vendor, and our application makes use of a customer-maintained Oracle 8i/9i database. We've had a customer request to support DB2 database, and I'm looking into the feasibility of migration. Our application runs on NT Server and, the DB2 database would be in some cases on a separate AIX machine, in other cases on an AS/400. There are two problems we are running into, both relating to our...
7
3942
by: peter.morin | last post by:
Issue: I am inserting an Oracle record containing insert trigger via Access 2002 using the code below. The issue is that the sequence from the acSaveRecord is not reflected after the insert so the insert into the second table section: ' Copy LOB entries now. fails on unique index constraint (understandable because it has the orig rate_id). The strange thing is that it works fine for new records that have beend added and then...
1
3022
by: MAL | last post by:
Hello, I have 2 classes that work great as a windows app to retrieve and process data from an Oracle9i db. When I implement them in a Service program running as Local System, it fails on the .open. I am using OLEDB for Oracle 9.2.0.4. I have verified the Oracle Client install, Local Sys' path variable, and followed MSKB article 259959(Debugging connectivity issues w/ Oracle). Here is the error:
8
14312
by: =?Utf-8?B?RGF2aWQrKw==?= | last post by:
Hi, I have been developing Web Services in VS2005. Usually I use the built in server in VS2005 to test and develop the Web Service. However I now want to make this Web Service available to other computers (and applications) in our local company network. When the service runs it accesses an Oracle database and pulls some data out. It works fine when running in VS2005 server. To allow the Web Service to
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.