472,353 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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.nextval
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.nextval into :new.id from
dual; end; " + "0x0d" + "/";

OleDbCommand myTrigger = new OleDbCommand(trigger,
myConnection);

myTrigger.ExecuteNonQuery();

AND

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

string trigger12 = "/";

OleDbCommand myTrigger11 = new OleDbCommand(trigger11,
myConnection);
OleDbCommand myTrigger12 = new OleDbCommand(trigger12,
myConnection);

myTrigger11.ExecuteNonQuery();
myTrigger12.ExecuteNonQuery();
----------------------
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 1964

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

Similar topics

0
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...
2
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...
9
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...
1
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...
4
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...
4
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...
7
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...
1
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...
8
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.