2

I have a procedure I need to feed a number into in order to generate some thumbnails.

I'm trying to automatically update the value every time a new row is inserted but I'm having trouble with the code.

DECLARE

varInt NUMBER :='SELECT MAX(IMAGE_ID) FROM IMAGES';

begin
create_blob_thumbnail(varInt);
end;

I get the error 'ORA-06502: PL/SQL: numeric or value error: character to number conversion error'

If I run the query SELECT MAX(IMAGE_ID) FROM IMAGES, it returns the last row ID I created just as it should.

The create_blob_thumbnail(varInt) procedure works fine if I manually put in a number.

Searched for ages and tried a lot of different things, anyone have any suggestions?

3
  • Worked it out! DECLARE varInt NUMBER; BEGIN SELECT MAX(IMAGE_ID) into varInt FROM IMAGES; create_blob_thumbnail(varInt); END; Commented Dec 3, 2012 at 18:26
  • Post the answer to your question as a real answer and then accept it. Nothing wrong with that! This question then won't end up as being unanswered. Commented Dec 3, 2012 at 19:54
  • Haha, sorry new to the site didn't realise I could do that! Cheers Commented Dec 3, 2012 at 20:06

1 Answer 1

1

Worked it out!

DECLARE

varInt NUMBER;

BEGIN

SELECT MAX(IMAGE_ID) into varInt FROM IMAGES;
create_blob_thumbnail(varInt);

END;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.