473,396 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Create Table In Oracle Procedures

Hello, I am new to all of this. I have basic SQL skills. I am trying to create a table using a procedure in Oracle Developer but I can't seem to get the table to create. I get no errors.

create or replace
PROCEDURE SKELETON2
Is
str long;
s_ERR VARCHAR2(500);
BEGIN
STR := 'CREATE TABLE ken_blah2 AS
SELECT sbscrp_id,
MONTH
FROM ken_test
where rownum < 10
';
execute immediate str;
s_ERR := 'SUCCESS';
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
s_ERR := ' ERROR: ' || SQLERRM;
END;
Jun 22 '07 #1
6 14358
Saii
145 Expert 100+
Hello, I am new to all of this. I have basic SQL skills. I am trying to create a table using a procedure in Oracle Developer but I can't seem to get the table to create. I get no errors.

create or replace
PROCEDURE SKELETON2
Is
str long;
s_ERR VARCHAR2(500);
BEGIN
STR := 'CREATE TABLE ken_blah2 AS
SELECT sbscrp_id,
MONTH
FROM ken_test
where rownum < 10
';
execute immediate str;
s_ERR := 'SUCCESS';
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
s_ERR := ' ERROR: ' || SQLERRM;
END;

Display the error to screen using dbms_output in exception block.
Do you have privilege to create tables in the schema?
Jun 22 '07 #2
Display the error to screen using dbms_output in exception block.
Do you have privilege to create tables in the schema?

I do not get an error. It simply does not create the table with the data. yes I have create table priviledges. Thanks
Jun 22 '07 #3
Did I do this correctly?

create or replace
PROCEDURE SKELETON
aS
s_ERR VARCHAR2(500);
STR LONG;
BEGIN
STR := '
CREATE TABLE ken_blah AS
SELECT sbscrp_id,
MONTH,
rankm,
cnt,
1 +
(SELECT COUNT(*)
FROM ken_test temp
WHERE temp.rankm < ken_test.rankm
AND temp.sbscrp_id = ken_test.sbscrp_id
AND kent_test.ROWNUM < 10)
rankmm
FROM ken_test
ORDER BY sbscrp_id,
chg DESC
';
execute immediate str;
s_ERR := 'SUCCESS';
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
s_ERR := ' ERROR: ' || SQLERRM;
dbms_output.enable(1000000);
END;
Jun 22 '07 #4
Sorry, different query but same issue.
Jun 22 '07 #5
debasisdas
8,127 Expert 4TB
does the second table exists in the same schema and/or u have select previleges on the table.
Jun 23 '07 #6
debasisdas
8,127 Expert 4TB
add this to the before END

u can find out the error

Expand|Select|Wrap|Line Numbers
  1. dbms_output.put_line(s_err);
Jun 23 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: expecthealth | last post by:
OPERATIONAL ORACLE DBA Position Description: This position will report to the Manager of Systems Services. The DBA will work in the Oracle environment and help manage a complex production...
5
by: Madjid Nasiri | last post by:
Hi, I am basic in oracle. My Old programs write with Delphi and Databases: Access, Paradox, MySQL, Microsoft SQL. I write my code (SQL code) case-insensitivae, but now i need use oracle database....
1
by: Suresh Tri | last post by:
Hi all, I am in search of any Enterprise level Opensource Project that uses Java Stored Procedures supported by Oracle. I could not find any by googling. Can any one plese point me to any such...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
14
by: aaron kempf | last post by:
I find that ADP does not support any Stored Procedures that use the 'CREATE PROC spHAPPY' syntax. CREATE PROC syntax is listed in books online. This syntax should be supported Here is a...
5
by: rAinDeEr | last post by:
Hi, Y'day one of my friend showed me how to connect to a Oracle database as SYSDBA, DBA etc I have DB2 UDB installed in Linux machine.Right now, I have a user WADI which has got some...
2
by: rcc.gamer | last post by:
Hello All, I am trying to connect a GridView to an Oracle table using the standard SqlDataSource. The process is fairly simple and there are detailed instructions from Microsoft ......
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
9
by: DottingTheNet | last post by:
help plz!! when i try to cretae a table in a procedure like create procedure blah is begin create table..... ...... end;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.