Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / General DB Topics / General DB Topics / January 2005

Tip: Looking for answers? Try searching our database.

why does procedure hang?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
- - 26 Jan 2005 07:09 GMT
can anybody assist me with the following procedure?

it can compile and works when i do any of the following:

CALL ACTIVATE_ACCOUNT('')
CALL ACTIVATE_ACCOUNT('123')

but when i do a

CALL ACTIVATE_ACCOUNT('0394df......') <-- forty alnum chars long, the
server hangs as in infinite loop. (the pc doesn't hang)
it seems that any forty character long input produces the error.

CREATE PROCEDURE ACTIVATE_ACCOUNT(IN p_uid CHAR(40))
BEGIN
        UPDATE
            account,
            member
        SET
            activated = 1
        WHERE
            account.id = member.account_id
                AND
            SHA1(CONCAT(account_id, email_address)) = p_uid AND
activated = 0;
END
--CELKO-- - 26 Jan 2005 14:40 GMT
What is Member doing in the UPDATE clause??   I assume that you meant
to say Accounts as a table name; the singular names are used for
scalars, so member must be a column name.

UPDATE Accounts
SET  activated = 1
WHERE EXISTS
(SELECT *
FROM Members AS M
WHERE  Accounts.account_id = M.account_id)
AND  SHA1(Accounts.account_id + Accounts.email_address)  =
Accounts.p_uid
AND Accounts.activated = 0;

I tried to fix the mulltiple names for the same data element.  There is
no magical, universal "id" in  a valid data model; **what** does it
identify?  Read any basic data modeling book.

I had to guess at the tables from which the columns were taken.

You do not explain what SHA1 is  - UDF?

You seem to be writing SQL with bit flags.  SQL programmers do not use
low level. asembly language constructs.  That went out with file
systems about 1970.
You might want to Google the syntax for an update statement.
DA Morgan - 26 Jan 2005 17:20 GMT
> can anybody assist me with the following procedure?
>
[quoted text clipped - 22 lines]
> activated = 0;
> END

Are we supposed to guess as to the product and version?

I guess Mauve. Version 1.3.

BTW: In any anguage ... this contains no looping structure.
Signature

Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)

SteveA - 26 Jan 2005 18:59 GMT
> can anybody assist me with the following procedure?

This topic relates to stored procedures in MySQL v5 (an alpha product),
and I claim my $5.

Solution: install a stable product.

---
Steve
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.