Topic: Stored procedure questions Pages that link to <a href="https://ozoneasylum.com/backlink?for=30420" title="Pages that link to Topic: Stored procedure questions" rel="nofollow" >Topic: Stored procedure questions\

 
Author Thread
redroy
Paranoid (IV) Inmate

From: 1393
Insane since: Dec 2003

IP logged posted posted 07-15-2008 23:57 Edit Quote

Hey all,

I've got a table with a varchar field... is it possible to store a "stored procedure" within the varchar? Say something simple like NOW(); and upon selecting I would get the current date? I guess I'm just a little confused on how to call the procedures...

edit2: whew, having a rough day... using MySql 5 btw.
edit: I can't spell either... if someone wants to fix my post title that would be great, mucho thanks

(Edited by redroy on 07-15-2008 23:58)

(Edited by redroy on 07-16-2008 02:57)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 07-16-2008 10:17 Edit Quote

uh... I have a gut feeling that your concepts are of on serveral levels .

First, I believe a stored procedure is something that you run instead of a complete query.
Second, The whole point of it is being compiled - something that wouldn't be possible if it was 'stored in a varchar'.
Third, when would you want this to be run? When the row's read? Or when it's stored?
Fourth, You can simple select *, now() as currentTime from table; - not that it makes much sense with the current time though.

Hope this allivates some of your problems,
so long,

->Tyberius Prime

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana
Insane since: Aug 2000

IP logged posted posted 07-16-2008 16:45 Edit Quote

You could also create TIMESTAMP or DATETIME fields in the record if you are trying to keep track of when the record was created or modified.

.



-- not necessarily stoned... just beautiful.

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

IP logged posted posted 07-16-2008 21:29 Edit Quote

SET s = [YOUR QUERY TO GET YOUR STATEMENT]

PREPARE stmt1 FROM @s;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;

The above is just a guess never actually tried that.

Dan
Code Town | Zombie Head | How Much TP? | Feed The Blob

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

IP logged posted posted 07-17-2008 13:02 Edit Quote

warmage: and 100% against everything stored procedures are actually meant for - at least if you do this each time

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

IP logged posted posted 07-17-2008 14:38 Edit Quote

Yes, but Redroy just asked how to do it, not what the best practice would be.

Redroy, if you were to elaborate on the problem you are trying to solve there will most likely be a better way to address it, as TP has said it is pretty bad practice, and potentially very dangerous.

Dan
Code Town | Zombie Head | How Much TP? | Feed The Blob

redroy
Paranoid (IV) Inmate

From: 1393
Insane since: Dec 2003

IP logged posted posted 07-23-2008 00:13 Edit Quote

After further looking into my "problem", which is basically working on a badly thought out and coded website, I'm thinking I'll save much grief by overhauling now. When I get a chance though I'd like to get back and pick your brains on this topic though (as obviously I haven't a clue).



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu