Skip to main content
Inspiring
December 5, 2007
Question

Procedure Help--too little urgent

  • December 5, 2007
  • 8 replies
  • 1329 views
How will I put below into a procedure to update the field called "elem_desc_x" under table "tbl_cert_faq_elem_dimn"?
I have the basic knowledge of procedures...
SELECT certf_i,
grp_ord_n,
qsn_ord_n,
QSN_I,
Ans_I,
( SELECT elem_desc_x
FROM tbl_cert_faq_elem_dimn
WHERE elem_i = qsn_i ) as qsn_x,
( SELECT elem_desc_x
FROM tbl_cert_faq_elem_dimn
WHERE elem_i = ans_i ) as ans_x,
( SELECT elem_desc_x
FROM tbl_cert_faq_elem_dimn
WHERE elem_i = grp_i ) as grp_x
FROM tbl_cert_faq_cntl_dimn
WHERE certf_i =2007.75
ORDER BY grp_ord_n,qsn_ord_n
This topic has been closed for replies.

8 replies

Inspiring
December 7, 2007
C'mon, Phil, what part of "I CAN HAZ DATABASE UPDATE?" don't you understand?

;-)
Inspiring
December 7, 2007
aaaaaaaaarrrrrrrrrrrrrrrgggggggggggggghhhhhhhhhhhhh!!!!!!!!!!!!!!!

please, please, please! make a step-by-step list of what you are trying
to do or something like that!
reading your attempts at describing your problem just hurts my brain...
and i don't have a cold

start with:
- current value in the filed you want to update
- desired new value for that field
- EXACTLY where this new value is coming from: a form field? another db
table? calculated from some variables? (and please do not say CF file)

---
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Participating Frequently
December 7, 2007
quote:

reading your attempts at describing your problem just hurts my brain...
Thanks, I was starting to think that it was me! I've had lots "fun" pulling requirements and business rules out of clients over the years, but one would assume that a "developer" could be able to be a little more articulate when expressing them.

Phil
emmim44Author
Inspiring
December 6, 2007
It could be the cold :P ...Feel better...
I am saying that I am to trying to use CF to update the records one by one...I need a store Proc in db level to corresponding records in 2007 then update the 2nd tb's elem_desc_x...That is all.
emmim44Author
Inspiring
December 6, 2007
Ok, lets say the value of elem_desc_x is coming from CF file...I will manage in CF site and as a proc?
Participating Frequently
December 6, 2007
Coming from CF file how? What do you mean by "..I will manage in CF site and as a proc.."? Sorry, I don't mean to sound dense, but you aren't making any sense to me at all. (I've got a horrible cold, so my head probably isn't allowing me to grasp what you are trying to get at.)

Anyone else have a clue?

Phil
emmim44Author
Inspiring
December 5, 2007
here is a quick sample...maybe there is no need for a proc since few records need to be updated....

UPDATE tbl_cert_faq_elem_dimn
SET
elem_desc_x = 'Who is required to complete the 2007 Annual Certification of Compliance?'
WHERE
where elem_I = 63
Participating Frequently
December 6, 2007
Your example wasn't particularly helpful, as you didn't say where the value for setting elem_desc_x is actually coming from. Are you saying that you want to set it to the value of the string 'Who is required to complete the 2007 Annual Certification of Compliance?'? Sorry, but you are being about a clear as mud.

Phil
emmim44Author
Inspiring
December 5, 2007
it is not that simple...The first tb(tbl_cert_faq_cntl_dimn) has 2nd tb's(tbl_cert_faq_elem_dimn) question and answer ID....once I got the correct records from the first tb then I would have to update few records in 2nd tb(tbl_cert_faq_elem_dimn) by manually changing the "elem_desc_x "...so how will that be in procedure
Participating Frequently
December 5, 2007
Your description of your requirements makes no sense, or is incomplete, at least to me. I believe that you must be much more forthcoming and descriptive of exactly what you are trying to do in order for anyone to be able to provide a meaningful recommendation. No mind readers here, so you have to describe everything that you want to do in as detailed a manner as possible.

Phil
emmim44Author
Inspiring
December 5, 2007
Oracle... lets say I want to update "elem_desc_x " from "Year 2006" to "year 2007"
Participating Frequently
December 5, 2007
I can't help feeling that you're leaving something out, but here goes.

Simply......

UPDATE tbl_cert_faq_elem_dimn
SET elem_desc_x = 'year 2007'
WHERE elem_desc_x = 'Year 2006'

and as a stored proc:

CREATE OR REPLACE PROCEDURE your_procedure
IS
BEGIN

UPDATE tbl_cert_faq_elem_dimn
SET elem_desc_x = 'year 2007'
WHERE elem_desc_x = 'Year 2006';

COMMIT;

END your_procedure;

Phil
Participating Frequently
December 5, 2007
Well, first of all, you posted a SELECT query and not an UPDATE. With what value do you wish to update elem_desc_x? What kind of database? (SQL Server, Access, Oracle, etc.) Start with an UPDATE statement, then adapt it to the stored procedure syntax of your particular database.

Phil