?
Solved

Single Quotes and Double Quotes

Posted on 2003-02-28
3
Medium Priority
?
1,271 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

765 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