Avatar of David VanZandt
David VanZandtFlag for United States of America

asked on 

My PL/SQL block chokes on Amazon Web Service procedure. Asking for a second pair of eyes?

Hi, I have learned in the past two hours a lot of approaches that don't work. I'm asking for a fresh pair of eyes, please. Using Oracle 19c on aws rds, the rdsadmin schema is what allows SYS level commands to execute in place of the usual ALTER statements. Also, rds uses log groups in lieu of the expected log group members. I have tried many, many variations on the syntax on code that seemingly passes the TOAD and SQL*Dev syntax checkers, but it all fails to run. 

DECLARE
loggroups NUMBER :=0 ;
stmt VARCHAR2(128); BEGIN     EXECUTE IMMEDIATE ('rdsadmin.rdsadmin_util.switch_logfile');     SELECT count(1) INTO loggroups FROM v$log;     IF loggroups < 9 THEN         EXECUTE IMMEDIATE ('rdsadmin.rdsadmin_util.add_logfile(128M)');     END IF; END; / /* this works outside of the block EXEC rdsadmin.rdsadmin_util.switch_logfile; */

Open in new window


AWSAWS RDSOracle Database

Avatar of undefined
Last Comment
Alex [***Alex140181***]
ASKER CERTIFIED SOLUTION
Avatar of Alex [***Alex140181***]
Alex [***Alex140181***]
Flag of Germany image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

>>this works outside of the block EXEC rdsadmin.rdsadmin_util.switch_logfile;

why don't you just call these package procedures "directly" without using "execute immediate"?!

Correct.  Execute immediate executes the 'string'.  It has no idea that it is a procedure, a select, or what.

So, you would need to provide the entire command to execute immediate.

So:, something like:
EXECUTE IMMEDIATE ('begin rdsadmin.rdsadmin_util.switch_logfile; end;');

That said, don't do that!

Just provide the procedure:
...
BEGIN
    rdsadmin.rdsadmin_util.switch_logfile;
    SELECT count(1) INTO loggroups FROM v$log;
...

Open in new window

Avatar of David VanZandt

ASKER

Missed that one entirely, tyvm. Alex, the log size is appropriate and is the default.
Glad, we could help ;-)
Btw, my question was rather about this one:
rdsadmin.rdsadmin_util.add_logfile(128M)

Open in new window

The parameter here (128M). What's the data type here?!
Avatar of David VanZandt

ASKER

FWIW Alex, I see that at some point in this thread I dropped the delimiters -- the string value should be ('128M'). To answer your question, varchar2:
Parameter nameData typeDefaultRequiredDescription
bytespositivenullNoThe size of the log file in bytes.
p_sizevarchar2YesThe size of the log file. You can specify the size in kilobytes (K), megabytes (M), or gigabytes (G).

Thanks David ;-) Now this makes sense :-))
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo