473,834 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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 UpdateProblemTa ble. 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 UpdateProblemTa ble('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
UpdateProblemTa ble(?,?,?)

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 2267
"Chris Cowles" <No****@For.mew rote in message news:<E8******* **********@bign ews5.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 UpdateProblemTa ble. 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 UpdateProblemTa ble('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
UpdateProblemTa ble(?,?,?)

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('''||fl d2||''');'
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*********@ed s.comwrote in message Questions:
"Chris Cowles" <No****@For.mew rote in message
news:<E8******* **********@bign ews5.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('''||fl d2||''');'
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.mew rote 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*********@ed s.comwrote in message Questions:
>"Chris Cowles" <No****@For.mew rote in message
news:<E8******* **********@bign ews5.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('''||fl d2||''');'
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.go ogle.com>...
"Chris Cowles" <No****@For.mew rote 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*********@ed s.comwrote in message Questions:
"Chris Cowles" <No****@For.mew rote in message
news:<E8******* **********@bign ews5.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('''||fl d2||''');'
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*********@ed s.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
3123
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 into another table. The table, however, is being used by other users via a website, so I need to make certain that website requests don't touch on the records I'm selecting / updating.
3
2487
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 using an Access Data Project ("ADP") and I'm satified with the table structure. I've moved on to building some front ends for our users. I'm running into situations where I want subreports to be built from queries that are dependent on the values in other controls. I've played with stored...
29
3200
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 psql which they already run on their server. Anything out there in Php?
19
3580
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 clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
4
5135
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 the file name by hand. So I converted the macro to code using tools-->references. The converted macro included the following statement: DoCmd.OutputTo acQuery, "qselLabelsBloodLog_output", "MicrosoftExcelBiff8(*.xls)", "S:\susan_cheree\lb041129.xls", True, "", 0
6
9359
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 - customers - 100 records). On the form there is a checkbox with a control source named "MARK" (boolean) from customer table. I can check and uncheck individual records fine. Then I created 2 command buttons named "Select All" and "Deselect All". The Onclick property of these buttons runs code...
1
1975
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 studio.net VB I have a datagrid that brings records from a stored procedure. Be selecting multiple datarows using a checkbox. All i want to do is update a field called 'Active' datatype bit from 0 to 1
5
10094
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 for each split but I have come to an impasse due to my limited knowledge of sql. The Raw data contains a number of columns with key columns similar to Name, Product and Partcode. The issue is that the Partcode column in the raw data can contain multiple values split by either a "," or a
3
20161
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 work how we want. Which i would like to make it work on the sql server side, and not have to change the db2 side as that takes some time from our developers. But this is what i want to do. I have a stored procedure that calls the db2 stored procedure to return 4 leave amounts(@Annual, @Sick,...
0
9796
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
9643
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
10790
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7755
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6952
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
5624
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...
2
3976
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3079
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.