I am not sure how to go about this.
I have an Oracle database with users in a district. Every time I have to add
a new district I have to reset the password. I thought, now why don't I use
Perl to just copy the users current info and insert that into the new
district with the name of the
What do you mean by 'insert that user into a new district'? Do you mean create
an oracle account?
--
Ron Reidt
Lead DBA
Array BioPharma, Inc.
-Original Message-
From: Robert [mailto:[EMAIL PROTECTED]
Sent: Thu 2/10/2005 11:26 AM
To: dbi-users@perl.org
Cc:
Subject:
Let me see if I can explain it better today. :-)
I have about 200 users in district 1. I need to add each of those users
into district 2 using the same information that they have in district 1.
I also need to make sure they are only inserted 1 time. They have a unique
employeeID, so I know I
From: Robert [EMAIL PROTECTED]
Date: 2005/02/11 Fri AM 07:10:25 CST
I have about 200 users in district 1. I need to add each of those users
into district 2 using the same information that they have in district 1.
I also need to make sure they are only inserted 1 time. They have a unique
There are so many ways to do this. Below is a PL/SQL way:
#
# not tested
#
my $sth = $dbi-prepare(qq{
BEGIN
FOR d IN (SELECT * FROM district1)
LOOP
BEGIN
INSERT INTO district2 (column_list)
VALUES (d);
EXCEPTION
WHEN dup_val_on_index THEN
On Fri, 11 Feb 2005 08:10:25 -0500, Robert [EMAIL PROTECTED] wrote:
Let me see if I can explain it better today. :-)
See: http://www.catb.org/~esr/faqs/smart-questions.html
I have about 200 users in district 1. I need to add each of those users
into district 2 using the same information that
Another way to do it, using DBI, conceptually (pseudo-code) would be to
* define a unique index on the district 2 table that includes just
the
employee id. After you've done this, then if you try to insert
a row into
the district 2 table with an employee id that already exists in
This would definitely be the better solution but assuming you are
constrained by an exiting schema you can accomplish your goal with a
simple insert statement.
The following almost complete insert statement will do what I think you
want to do:
INSERT INTO district_table
SELECT 'District 2',
Jonathan Leffler [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Fri, 11 Feb 2005 08:10:25 -0500, Robert [EMAIL PROTECTED] wrote:
Let me see if I can explain it better today. :-)
See: http://www.catb.org/~esr/faqs/smart-questions.html
I have about 200 users in district 1. I
I'm no database expert (I'm probably way off here), but doesn't that
need to be more like this:
INSERT INTO district2
SELECT employee_id, ...
FROM district1
And, that still doesn't address the issue of duplicate employee id's.
I think to address that problem you'd have to define a
Maybe id should have added a bit more detail.
For simplicity sake I will assume that the table only has three columns:
employee_id, district_number, and everything_else
Assume the table has these values:
1 | 'District 1' | 'any other data'
2 | 'District 1' | 'any other data'
5 | 'District 1' |
Robert,
Did I misunderstand the question entirely? Are users in districts
stored in different tables within the database? If so then my previous
messages are largely useless. Can you please provide some more details
on this problem?
Mark
-Original Message-
From: Robert [mailto:[EMAIL
From: Robert [EMAIL PROTECTED]
Date: 2005/02/11 Fri AM 08:27:56 CST
Oh I wish I could! I am constrained by a 3rd party application that uses
Oracle as a big ole flat file. Where every table is padding with spaces!
Every table. I could shoot the people that created this application. You
Nope you got it. I am just mulling in my thick head.
Robert
From: Robert [EMAIL PROTECTED]
Date: 2005/02/11 Fri PM 12:55:03 CST
Nope you got it. I am just mulling in my thick head.
Say what? We're quite willing to help, we just need a little more data to do
so...
Robert
amonotod
--
`\|||/ amonotod@| sun|perl|windows
(@@)
Hello everyone,
I'm trying to insert into an oracle db. There's nothing wrong with the
connection it seems, I can retrieve records from the db just fine.
However, I can't seem to commit.
Here's my code:
Note: the line with the regex in it is just to parse the text file so
that I can have
Hi Nelson,
Is there an error message or messages the result from this script?
For all we know, your failure to commit is just a personal problem. :)
Also, you are committing every row. Please stop doing that,
your database will love you for it.
Just issue one commit at the end of the loop,
On Fri, 2005-02-04 at 07:06, Adam Stoller wrote:
Once we fixed that, we found that with ORACLE_HOME being protected (750
directory access) using 'sudo make' wasn't sufficient - and we had to
change the access rights on ORACLE_HOME to 755
A better way to do this might be to build a version
18 matches
Mail list logo