Procedure Compilation

pts.
Tags:
Database
IBM DB2
Oracle
Hi Friends, Have a small glitch and hence hope you will spare me a moment. Have a small procedure and it is not compiling. Could you just have a look and let me know why ? Thank You, :) Friend33 PROCEDURE Create or replace procedure proc_name IS Pwd varchar2(8); user varchar2(8); v_email varchar2(40); BEGIN Create or replace FUNCTION new_password RETURN VARCHAR IS only_alpha_characters CONSTANT VARCHAR2 (1) := 'A'; BEGIN --Get a random alphanumeric string 10 characters long DBMS_RANDOM.SEED (TO_CHAR (SYSDATE, 'MM-DD-YYYY HH24:MI:SS')); RETURN DBMS_RANDOM.STRING (only_alpha_characters, 8); END new_password; END proc_name;

Answer Wiki

Thanks. We'll let you know when a new response is added.

If you are going to embed a FUNCTION in a PROCEDURE, then it doesn’t have “CREATE OR REPLACE” and it must be in the declaration section:

Create or replace procedure proc_name IS
Pwd varchar2(8);
user varchar2(8);
v_email varchar2(40);
FUNCTION new_password RETURN VARCHAR IS
only_alpha_characters CONSTANT VARCHAR2 (1) := ‘A';
BEGIN
–Get a random alphanumeric string 10 characters
long
DBMS_RANDOM.SEED (TO_CHAR (SYSDATE, ‘MM-DD-YYYY
HH24:MI:SS’));
RETURN DBMS_RANDOM.STRING (only_alpha_characters, 8);
— You said 10 characters, but this has “8” as a parameter???
END new_password;
BEGIN
null; –Put some good stuff here.
END proc_name;
/

I hope this helps!!!

((MrO))

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Friend12
    [...] Address: http://itknowledgeexchange.techtarget.com/itanswers/procedure-compilation/ (0) Comments Read [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following