?
Solved

Single Quotes and Double Quotes

Posted on 2003-02-28
3
Medium Priority
?
1,280 Views
Last Modified: 2007-12-19
I need to execute this statement from within a package:

EXECUTE IMMEDIATE 'execute dbms_stats.gather_table_stats(SCHEMAOWNER,TABLE_NAME)';

I can't seem to get the quotes within the single quotes correct.

TIA,

David
0
Comment
Question by:david_read
  • 2
3 Comments
 
LVL 6

Accepted Solution

by:
M-Ali earned 300 total points
ID: 8046433
Try something like this:

..........
  EXECUTE IMMEDIATE 'BEGIN dbms_stats.gather_table_stats(''SCOTT'',''EMP''); END;';
..........

if the schemaowner and table names would change use this:

........
  EXECUTE IMMEDIATE 'BEGIN dbms_stats.gather_table_stats(:owner_name,:table_name); END;' USING var_ownername, var_tablename;
end;
........


HTH

Ali
0
 

Author Comment

by:david_read
ID: 8047662
Thanks for the reply.

I did a cut and paste and it appears that SCOTT is surrounded by pairs of single quotes, although they appear as double-quotes on the web site.

I was thinking of using your second suggestion as well.

David
0
 

Author Comment

by:david_read
ID: 8047695
Not only did it compile, it executed too.

I had tried the pairs of single quotes, but not within a  BEGIN-END structure.

Many thanks.

David
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

616 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question