472,342 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

[newbie] select records, update with procedure

I use an application that uses Oracle 8.1.7. All functions of the
application are completed with calls to stored procedures. A data entry
error occurred that caused thousands of records to be created with a
consistent error in a single field. I can identify those easily records with
a select statement. I'd *really* rather not have to change them all
manually.

I do have access to run a simple update query to correct only the field in
question, but that won't trigger other events like insert records into
application transaction logs, print update notices, etc. All of those are
accomplished by the procedure I'll call UpdateProblemTable. The parameters
of the procedure correspond to all fields in the table affected.

I've successfully used some other procedures by constructing a script using
an Access (gack!) select query, then exporting that to a text file. It's not
very sophisticated but it is accurate and works fine, except when one of the
parameters is a date. It's also a rather primitive way to go about this, I'm
sure.

When the procedure call fails, the error message says something to the
effect of missing a parenthesis. Since it only happens when I try to pass a
date as a parameter, I'm guessing a bad date format causes it.

What I'm sending is: Call UpdateProblemTable('field1' (text), field2
(number), 7/31/2003 23:45:00) .

Questions:

1. How should I format this date field?

2. Is there a simpler way to accomplish this? From browsing this group, I
see references to 'select into procedure'. If I could do something like
that, this would be a piece of cake. If so, I'm guessing it would be
something like:

Select 'correct', field2, field3 from ProblemTable where field1='wrong' into
UpdateProblemTable(?,?,?)

Am I way off base? If not, the field I'm updating is a text field, so the
date issue is moot. (Note: I do not have rights to create tables or anything
like that. For the purposes of this issue, I'm pretty much limited to
select, update, and call procedure.)

I have other uses for a similar call to another procedure, but need to
provide a specific date as a parameter in that case. So, for that, I do need
to know how to provide a date as a parameter.

Thanks for in advance for your time and advice.

Chris
Jun 27 '08 #1
5 2154
"Chris Cowles" <No****@For.mewrote in message news:<E8*****************@bignews5.bellsouth.net>. ..
I use an application that uses Oracle 8.1.7. All functions of the
application are completed with calls to stored procedures. A data entry
error occurred that caused thousands of records to be created with a
consistent error in a single field. I can identify those easily records with
a select statement. I'd *really* rather not have to change them all
manually.

I do have access to run a simple update query to correct only the field in
question, but that won't trigger other events like insert records into
application transaction logs, print update notices, etc. All of those are
accomplished by the procedure I'll call UpdateProblemTable. The parameters
of the procedure correspond to all fields in the table affected.

I've successfully used some other procedures by constructing a script using
an Access (gack!) select query, then exporting that to a text file. It's not
very sophisticated but it is accurate and works fine, except when one of the
parameters is a date. It's also a rather primitive way to go about this, I'm
sure.

When the procedure call fails, the error message says something to the
effect of missing a parenthesis. Since it only happens when I try to pass a
date as a parameter, I'm guessing a bad date format causes it.

What I'm sending is: Call UpdateProblemTable('field1' (text), field2
(number), 7/31/2003 23:45:00) .

Questions:

1. How should I format this date field?

2. Is there a simpler way to accomplish this? From browsing this group, I
see references to 'select into procedure'. If I could do something like
that, this would be a piece of cake. If so, I'm guessing it would be
something like:

Select 'correct', field2, field3 from ProblemTable where field1='wrong' into
UpdateProblemTable(?,?,?)

Am I way off base? If not, the field I'm updating is a text field, so the
date issue is moot. (Note: I do not have rights to create tables or anything
like that. For the purposes of this issue, I'm pretty much limited to
select, update, and call procedure.)

I have other uses for a similar call to another procedure, but need to
provide a specific date as a parameter in that case. So, for that, I do need
to know how to provide a date as a parameter.

Thanks for in advance for your time and advice.

Chris
Chris, Oracle normally expects character date strings in the format
'DD-Mon-YY' unless otherwise specified.

You can use SQL via SQLPLUS to generate execute procedure(parms) to
perform your updates:

UT1 select ' execute my_proc('''||fld2||''');'
2 from marktest;

'EXECUTEMY_PROC('''||FLD2||''');'
-------------------------------------------------------------
execute my_proc('1');
execute my_proc('2');
execute my_proc('3');
execute my_proc('4');
execute my_proc('5');

You would want to set pagesize 0, set feedback off, set trimspool on
etc... to keep the execute script file clean

HTH -- Mark D Powell --
Jun 27 '08 #2
Mark -

Thanks for the time spent responding.

I found to_date() discussed in other threads. Those explained sufficiently
what my formatting problems were.

It sounds like the select 'execute....' may be the most efficient method. I
can work on generating the select statement without the 'execute
my_procedure(..' part to get the field syntax right, then add the execute
statement.

If a field already contains a date/time, can I just pass it, unformatted? Or
do I have to format the text output back through to_date, before passing it
to the execute statement?
"Mark D Powell" <Ma*********@eds.comwrote in message Questions:
"Chris Cowles" <No****@For.mewrote in message
news:<E8*****************@bignews5.bellsouth.net>. ..

[truncated]
1. How should I format this date field?

2. Is there a simpler way to accomplish this?
[truncated]
Chris, Oracle normally expects character date strings in the format
'DD-Mon-YY' unless otherwise specified.

You can use SQL via SQLPLUS to generate execute procedure(parms) to
perform your updates:

UT1 select ' execute my_proc('''||fld2||''');'
2 from marktest;

'EXECUTEMY_PROC('''||FLD2||''');'
-------------------------------------------------------------
execute my_proc('1');
execute my_proc('2');
execute my_proc('3');
execute my_proc('4');
execute my_proc('5');

You would want to set pagesize 0, set feedback off, set trimspool on
etc... to keep the execute script file clean

HTH -- Mark D Powell --

Jun 27 '08 #3
"Chris Cowles" <No****@For.mewrote in message news:<xl*************@bignews1.bellsouth.net>...
Mark -

Thanks for the time spent responding.

I found to_date() discussed in other threads. Those explained sufficiently
what my formatting problems were.

It sounds like the select 'execute....' may be the most efficient method. I
can work on generating the select statement without the 'execute
my_procedure(..' part to get the field syntax right, then add the execute
statement.

If a field already contains a date/time, can I just pass it, unformatted? Or
do I have to format the text output back through to_date, before passing it
to the execute statement?
"Mark D Powell" <Ma*********@eds.comwrote in message Questions:
>"Chris Cowles" <No****@For.mewrote in message
news:<E8*****************@bignews5.bellsouth.net>. ..
>
[truncated]
1. How should I format this date field?
>
2. Is there a simpler way to accomplish this?
[truncated]
>
Chris, Oracle normally expects character date strings in the format
'DD-Mon-YY' unless otherwise specified.

You can use SQL via SQLPLUS to generate execute procedure(parms) to
perform your updates:

UT1 select ' execute my_proc('''||fld2||''');'
2 from marktest;

'EXECUTEMY_PROC('''||FLD2||''');'
-------------------------------------------------------------
execute my_proc('1');
execute my_proc('2');
execute my_proc('3');
execute my_proc('4');
execute my_proc('5');

You would want to set pagesize 0, set feedback off, set trimspool on
etc... to keep the execute script file clean

HTH -- Mark D Powell --
Chris, it would depend on how the procedure was written. If it was
written to be called with a date then you would need create a valid
date variable using to_char('date','format'). If the procedure
expects a character string that it will convert to a date then you
pass the expected character string format.

HTH -- Mark D Powell --
Jun 27 '08 #4
Ma*********@eds.com (Mark D Powell) wrote in message news:<26**************************@posting.google. com>...
"Chris Cowles" <No****@For.mewrote in message news:<xl*************@bignews1.bellsouth.net>...
Mark -

Thanks for the time spent responding.

I found to_date() discussed in other threads. Those explained sufficiently
what my formatting problems were.

It sounds like the select 'execute....' may be the most efficient method. I
can work on generating the select statement without the 'execute
my_procedure(..' part to get the field syntax right, then add the execute
statement.

If a field already contains a date/time, can I just pass it, unformatted? Or
do I have to format the text output back through to_date, before passing it
to the execute statement?
"Mark D Powell" <Ma*********@eds.comwrote in message Questions:
"Chris Cowles" <No****@For.mewrote in message
news:<E8*****************@bignews5.bellsouth.net>. ..

[truncated]
1. How should I format this date field?

2. Is there a simpler way to accomplish this?
[truncated]

Chris, Oracle normally expects character date strings in the format
'DD-Mon-YY' unless otherwise specified.
>
You can use SQL via SQLPLUS to generate execute procedure(parms) to
perform your updates:
>
UT1 select ' execute my_proc('''||fld2||''');'
2 from marktest;
>
'EXECUTEMY_PROC('''||FLD2||''');'
-------------------------------------------------------------
execute my_proc('1');
execute my_proc('2');
execute my_proc('3');
execute my_proc('4');
execute my_proc('5');
>
You would want to set pagesize 0, set feedback off, set trimspool on
etc... to keep the execute script file clean
>
HTH -- Mark D Powell --

Chris, it would depend on how the procedure was written. If it was
written to be called with a date then you would need create a valid
date variable using to_char('date','format'). If the procedure
expects a character string that it will convert to a date then you
pass the expected character string format.

HTH -- Mark D Powell --
Whoops. Make that to_date('date','format') to conver the character string to date.

-- Mark --
Jun 27 '08 #5
Thought so. Thanks for the clarification.

"Mark D Powell" <Ma*********@eds.comwrote in message
Chris, it would depend on how the procedure was written. If it was
written to be called with a date then you would need create a valid
date variable using to_char('date','format'). If the procedure
expects a character string that it will convert to a date then you
pass the expected character string format.

HTH -- Mark D Powell --

Whoops. Make that to_date('date','format') to conver the character string
to date.
>
-- Mark --

Jun 27 '08 #6

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

Similar topics

2
by: M Wells | last post by:
Hi All, I need to change a column value in several thousand records in a table and output a list of the record ids of the records I've updated...
3
by: Ryan.Chowdhury | last post by:
This is a general question regarding the use of view and stored procedures. I'm fairly new to databases and SQL. I've created a SQL database...
29
by: Mainlander | last post by:
An ISP I belong to uses Majordomo for their mailing list system. I'd like to encourage them to move to a system that uses a database, preferably...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and...
4
by: Polly | last post by:
I had a macro that ran a parameter query and created and opened an Excel file with the system date as part of the file name, but I had to change...
6
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex...
1
by: Wolffang | last post by:
From: "Wolffang" <javid@techlite.co.uk> Subject: How to do a multiple select and update in a datagrid Date: 23 October 2004 21:28 Using Visual...
5
by: mctime | last post by:
Hello, I am attempting to split a raw data table into a new table that has split out a specific field in the raw data and created a new record...
3
by: barmatt80 | last post by:
I finally got my call to a stored procedure on our db2 to work. However i might have to change what the stored procedure does, if I cannot get it to...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
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: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
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
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. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
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...

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.