Can I create a table in a procedure submitted to job queue?
I have created a package (with AUTHID CURRENT_USER) where some of the procedures create temporary tables to facilitate processing. These procedures run just fine when executed directly from within an anonymous block at the SQL*PLUS level. However, when I submit the procedures to the job queue (via DBMS_JOB.SUBMIT), the job is submitted successfully but fails when run. Investigating the Alert Log shows an error of insufficient privilege on the CREATE TABLE command in the procedure.
QUESTION:
Can I create a table from a procedure running in the Job Queue? If so, then how to get it to work? Does the job run in a different environment that needs Create Table privileges set to my schema?
Thanks for any info you can provide.
John
FYI: Found the problem. In the Administrator's Guide (of course not in the supplied packages documentation about DBMS_JOB) I found:
"How Jobs Execute
SNP background processes execute jobs. To execute a job, the process creates a session to run the job.
When an SNP process runs a job, the job is run in the same environment in which it was submitted and with the owner's default privileges.
When you force a job to run using the procedure DBMS_JOB.RUN, the job is run by your user process. When your user process runs a job, it is run with your default privileges only. Privileges granted to you through roles are unavailable."
And of course we had set up our users to get all privileges through Roles, so CREATE TABLE wasn't one of my DEFAULT PRIVILEGES!
It sure would be nice if Oracle documentation could get its act together and provide ALL information about a topic in a logical place. The effort to find the information about privileges occurred after it took me 1/2 hour to figure out why my submissions were failing - I didn't have the ';' included in the quoted string for the procedure to be called - which I only figured out after looking at the code for DBMS_JOB where it made the note to make sure you include the ';'. Wouldn't it be good to have that MINOR DETAIL mentioned in the description of DBMS_JOB.SUBMIT?????
Similar Messages
-
Creating a table in a Procedure
Hi All,
Creating a table in a procedure is recommended or not. Please share me some knowledge on what kind of implications/ problems would be if my code forced me to do like this below.
CREATE OR REPLACE
PROCEDURE P12
AS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE T1( N NUMBER )';
--some statements
END;Thanks,Hi,
968217 wrote:
Hi All,
Creating a table in a procedure is recommended or not. As the others have said, it is not recommended. Creating tables in PL/SQL is almost always a very bad idea.
Please share me some knowledge on what kind of implications/ problems would be if my code forced me to do like this below.What do you mean by "my code forced me to do like this"? How can your code force you to do anything?
CREATE OR REPLACE
PROCEDURE P12
AS
BEGIN
EXECUTE IMMEDIATE 'CREATE TABLE T1( N NUMBER )';
--some statements
END;Why would you even consider doing that? Isn't it simpler to say
CREATE TABLE T1( N NUMBER );
--some statements? -
Can I create a table in my form?
Our need our teachers to fill out a field trip form using a table format?
Can I create a table in my form?
and if yes, how?
thank you
Need it to look like this:
DATE
TIME
To start/finish
Name of Program
TEACHER’S
NAME
TEACHER’S EMAIL
# OF
STUDENTS
Setup in
Room #
02-07-14
9:20-10:35
Soil Rocks
Juday
20
118
02-07-14
10:50-12:05
Soil Rocks
Guild
20
118
02-07-14
12:45-2:00
Soil Rocks
Neptune
20
118
02-07-14
2:15-3:30
Soil Rocks
Webb
20
118Yes and yes.
If you have questions about creating the PDF form, you can use the Acrobat Forms forum: http://forums.adobe.com/community/acrobat/forms?view=discussions -
Can we create internal table dynamically ? how?
hi to all experts,
can we create internal table dynamically ? how?plz explain me with an example.Anybody with good example will be rewarded.it was asked in an interview what the answer for itHI
Yes you can create
see this
/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
JUST USE THIS CODE AND DO THE ESSENTIAL CHANGES ACCORDING TO YOU
STEP: 1 - get backend field catalog (currently displayed alv)
CLEAR: tl_fieldcatalog. REFRESH: tl_fieldcatalog.
CALL METHOD w_grid->get_backend_fieldcatalog
IMPORTING
et_fieldcatalog = tl_fieldcatalog.
STEP: 2 - create a new fieldcatalog for dynamic internal table
CLEAR: sl_fieldcatalog.
CLEAR: t_outtab_fieldname. REFRESH: t_outtab_fieldname.
CLEAR: tl_fieldcatalog_new. REFRESH: tl_fieldcatalog_new.
CLEAR: t_download_fieldname. REFRESH: t_download_fieldname.
CLEAR: t_download_fieldheading. REFRESH: t_download_fieldheading.
LOOP AT tl_fieldcatalog INTO sl_fieldcatalog.
STEP: 2.1 - populate data in T_OUTTAB_FIELDNAME
APPEND sl_fieldcatalog-fieldname TO t_outtab_fieldname.
STEP: 2.2 - populate TL_FIELDCATALOG_NEW & T_DOWNLOAD_FIELDNAME
IF sl_fieldcatalog-no_out EQ ''.
IF sl_fieldcatalog-fieldname NE 'STATUS'
OR sl_fieldcatalog-fieldname NE 'MESG_STATUS'
OR sl_fieldcatalog-fieldname NE 'ZLOCK'
OR sl_fieldcatalog-fieldname NE 'T_PLANT'
OR sl_fieldcatalog-fieldname NE 'T_CSR'.
If field is COMM_PLANT, change its length
IF sl_fieldcatalog-fieldname EQ 'COMM_PLANT'.
sl_fieldcatalog-outputlen = 1800.
sl_fieldcatalog-intlen = 1800.
sl_fieldcatalog-dd_outlen = 1800.
ENDIF. "comm_plant
sl_fieldcatalog_new = sl_fieldcatalog.
APPEND sl_fieldcatalog_new TO tl_fieldcatalog_new.
APPEND sl_fieldcatalog-fieldname TO t_download_fieldname.
APPEND sl_fieldcatalog-scrtext_l TO t_download_fieldheading.
CLEAR: sl_fieldcatalog, sl_fieldcatalog_new.
ENDIF.
ENDIF.
ENDLOOP.
STEP: 3 - create dynamic internal table
FREE: ref_download.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
I_STYLE_TABLE =
it_fieldcatalog = tl_fieldcatalog_new
IMPORTING
ep_table = ref_download
E_STYLE_FNAME =
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ASSIGN ref_download->* TO <ft_download>.
CREATE DATA ref_wa LIKE LINE OF <ft_download>.
ASSIGN ref_wa->* TO <fs_download>.
STEP: 4 - populate data in dynamic internal table
LOOP AT t_outtab INTO wa_outtab.
LOOP AT t_download_fieldname.
ASSIGN COMPONENT t_download_fieldname OF STRUCTURE
<fs_download> TO <fs_download_field>.
IF t_download_fieldname-field EQ 'COMM_PLANT'.
STEP: 4.1 - get long text from database table
CLEAR: wal_table.
SELECT SINGLE * FROM zshaven_plnt_txt
INTO wal_table
WHERE vbeln = wa_outtab-vbeln
AND posnr = wa_outtab-posnr
AND del_no = wa_outtab-del_no
AND del_itm = wa_outtab-del_itm.
IF sy-subrc EQ 0.
STEP: 4.2 - break long-text into separate lines
CLEAR: tl_text. REFRESH: tl_text.
SPLIT wal_table-plant_comm
AT '~'
INTO TABLE tl_text.
STEP: 4.3 - Combine these separate lines with space in
between two lines
CLEAR: wal_text, final_text.
LOOP AT tl_text INTO wal_text.
IF final_text IS INITIAL.
final_text = wal_text.
ELSE.
CONCATENATE final_text '-' wal_text
INTO final_text.
REPLACE '-' WITH ' ' INTO final_text.
ENDIF.
ENDLOOP.
STEP: 4.4 - move long text to work-area
<fs_download_field> = final_text.
ENDIF. "subrc
ELSE. "t_download_fieldname
READ TABLE t_outtab_fieldname
WITH KEY field = t_download_fieldname-field.
ASSIGN COMPONENT t_outtab_fieldname-field OF STRUCTURE
wa_outtab TO <fs_outtab_field>.
<fs_download_field> = <fs_outtab_field>.
ENDIF.
ENDLOOP.
STEP: 4.5 - Move data from work-area to dynamic internal table
APPEND <fs_download> TO <ft_download>.
CLEAR: <fs_download>.
ENDLOOP.
STEP: 5 - download
CALL FUNCTION 'DOWNLOAD'
EXPORTING
filename = 'C:\zshaven.xls'
filetype = 'DAT'
filetype_no_show = 'X'
filetype_no_change = 'X'
TABLES
data_tab = <ft_download>
fieldnames = t_download_fieldheading
EXCEPTIONS
invalid_filesize = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
customer_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. -
Can we create a table in temp tablespace?
Hi Support ,
I have confused about on point that Can we create a table in temp tablespace.
thanksI so not think the question is so bad except that it was as suggested something you can determine for yourself in 20 seconds:
> /
create table mark (fld1 number) tablespace tmp
ERROR at line 1:
ORA-02195: Attempt to create PERMANENT object in a TEMPORARY tablespace
Other database products allow users to create tables in the temporary tables such as SQL Server. I just tested using SQL Server 2008 R2 and I could create a table in TEMPDB.
SQL Server also creates temporary tables, create table #table_name, in TEMPDB. You can see these objects while in use.
IMHO -- Mark D Powell -- -
Can I create a table called user
Dear buddies,
Can I create a table called user in my database.
Please guide me.
Thanks in advance.
Nithuser645399 wrote:
I was required to create one for some reasons by a vendor so that Oracle will work with their tool.
This tells you more about the vendor than the vendor would like you to know ......
Like the vendor that told me their product would work with an oracle database, but they preferred SQL Server because "oracle doesn't perform will with more than 5 concurrent connections". Fortunately we were still in product evaluation and I was able to get them cut from the short list.
After seeing all your replies, now, I have contacted them asking for alternatives and explanations.
Anyway, Thank You to everyone of you.
Nith -
Dear Experts,
How Can I create plan Table.
How can i read it?run UTLXPLAN.SQL
under
$ORACLE_HOME/rdbms/admin/
check this link for detailed information
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14211/ex_plan.htm#i19260 -
Can i create External Table dynamically
Hi,
Is it possible to create External Table dynamically ?
I want to use the following dynamically to create External Table.
1) fields
2) field position
3) file location
ThanksThe answer shouldn't be very different of already given answers in your Can i create external table dynamically? of the last month, is it ?
And question is still same : why wanted such thing ?
Nicolas. -
How can I create a table in other's schema?
I have two users say 'user1' and 'sanju' along with other users in the database.Both the users are granted a connect role. I have connected as a 'sanju' user. Now I want to create a table in schema 'user1'.
Please note that user 'sanju' should not be allowed to create table in any other user's schema.
I have set the current schema of 'sanju' as 'user1'.
ALTER SESSION SET CURRENT_SCHEMA=USER1
I know that 'grant create ANY table to sanju' will allow 'sanju' to create table in all the schema. I dont want that. Is there any way to create a table in any other's schema?
Please answer ASAPThis is not directly possible, but you can use following workaround:
connect user1/passwd
create or replace procedure testCreateTable as
begin
execute immediate 'create table user1.testTable(c char)';
end test;
grant execute on testCreateTable to sanju;
connect sanju/passwd
execute testCreateTable
Of course, you can make this procedure more generic by specifying the necessary parameter.
Please not that this procedure only works, if user1 was granted the create table privilege directly, and not through a role (e.g. dba), because roles are disabled when executing -
Insufficient privileges for creating a table in a procedure
Hello,
I have a problem with creating a table from within a procedure. The error is
-1031 : ORA-01031: insufficient privileges
All objects are owned by the same user, and the procedure is run under that user. This user has CREATE ANY TABLE with Admin Option rights.
I am working with Oracle 8i.
Can anybody tell me how I can fix this?
Thanks, WouterDoes the user have the CREATE ANY TABLE privilege granted directly to it, or through a role? Stored procedures by default don't know about any privileges granted through a role.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
How can i create a table which name is dynamic and not static?
i have a question to ask. normaly if i want to create a table, i must provid a name for the table. for example, create table tt (id number(5)). But now in my application, I need to control the table name with params through function, how can i do?
thxFirst thank you to reply so fast!
But I met problem according to your instructive. The following is my code:
declare
m varchar(5);
begin
m:='hello';
execute immediate 'create table'|| m ||'(id number(5),name varchar(5))';
commit;
end;
The SQL*Plus tell me the command create is invalid. My oracle is 8.1.7.0.0. Maybe I miss something so that I can not get correct result. Wish your further help.
yours sincerely
zhou jinguang -
How can I create a Table View in Cocoa Applescript?
This is my last resort. I've searched for days and only found tutorials for iPhone and Cocoa, and I have no idea where to start. I'm looking for a way to create a Table View, and fill it with a few cells that call a handler when clicked. I've looked through the Xcode help, the Apple documentation, and countless tutorials, and I don't know what to do. I'm sure what I'm asking is possible, because usually what is possible in Cocoa is possible in Cocoa-Applescript.
Perhaps something like:
myTableView's addCell_OfType_WithHandler("This is a text cell", text, "myHandler:")
I would appretiate any responses and brief descriptions on the matter.You did not answer my first question, which was not an idle question. I'll answer here, but if cross-chatter appears in a different thread I'll ignore it. You'll have to keep track of the mess yourself.
Apple_For_The_Win wrote:
At this point, I've dragged a Table View onto my window, in Xcode. I've connected it to the value "myTableView", and that's where I need help. I'm specifically trying to add cells into the table view.
I'll assume that 'connected it to the value "myTableView"' means that you've control-dragged in XCode from the table view in Main Menu.xib to a property in your applescript app delegate called myTableView. If that's not the case, please correct me.
I prefer to use an array controller for this, so please drag an array controller object into main menu.nib. once you've done that, do the following:
open the applescript app delegate and add a new property called "tableController"
select the table view in the object list (you may need to open some disclosure triangles to reach it). and add appropriate (an) column name(s). you can hide column titles later if you like, but having named columns makes life easier.
select the array controller in the object list
rename the array controller "table data"
open the attributes inspector, and then add the column name(s) as key(s) in the object controller area
open the bindings inspector, and where it says "controller content", open the disclosure arrow and bind the content to the App Delegate object on the model key path self.tableController
select the table view in the object list again, then go down a level and select each column in turn
for each column, open the bindings inspector, and where it says "value", open the disclosure arrow and bind the content to the Table Data object with the controller key arrangedObjects model key path being the name of the column (which is the name of the key in the controller as well)
back in the applescript app delegate, add code like the following:
-- create a list of records, where each record represents a row and the column name is the record key
set myData to {{column_1_name:"hello"}}
-- convert it to an NSArray and add it to the controller content. don't forget the *my* keyword, or it won't work
set my tableController to NSArray's arrayWithArray:myData
-- may or may not be needed
myTableView's reloadData()
That should populate the table with simple text. if you want something more complicated (like buttons or links) then create the more complicated elements separately and add them to the data. -
Can you create a table of contents for the documents within a PDF Portfolio?
If I create a pdf portfolio that contains multiple documents (e.g. Word, multiple PDFs and Excel documents), is there a way to create a table of contents at the beginning of the portfolio to help navigate to the individual documents?
Hi,
The Files list displays a list of files, so the user can quickly see all the files in the portfolio with any information you want to share; title, description, file type, size etc.
Or, you can also use a different layout, for example, the Linear and use the space next to each file to describe it.
Hope this helps.......
JGaf -
Adobe PDF Pack - Can I create a Table of Contents in combined PDF files I am creating?
Can I create in Adobe PDF Pack a table of contents for PDF files I am combining?
If the answer is YES do I name each of the PDF documents name the name I want the page to be named in the Table of Contents?
Thank you.
MichaelHi Michael,
When you combine files into a single PDF, each file you include will have a bookmark in the Bookmarks panel in Acrobat/Reader. So, I suppose you could treat that as a Table of Contents. (It doesn't, however, create a separate TOC and append it to the file.) The bookmark names reflect the filename of each file you combined.
I hope that answers your question.
Best,
Sara -
How can we create a table with more than 64 fields in the default DB?
Dear sirs,
I am taking part in the process of migrating a J2ee application from JBoss to SAP Server. I have imported the ejb project.
I have an entity bean with 79 CMP fields. i have created the bean and created the table for the same also. but when i tried to build the dictionary, i am getting an error message as given below,
"Dictionary Generation: DB2:checkNumberOfColumns (primary key of table IMP_MANDANT): number of columns (79) greater than allowed maximum (64) IMP_MANDANT.dtdbtable MyAtlasDictionary/src/packages"
Is it mean that we can not create tables with fields more than 64?
How can i create tables with more than 64 fields?
Kindly help,
Thankyou,
Sudheesh...Hi,
I found a link in the help site which says its 1024 (without key 1023).
http://help.sap.com/saphelp_nw04s/helpdata/en/f6/069940ccd42a54e10000000a1550b0/content.htm
Not sure about any limit of 64 columns.
Regards,
S.Divakar
Maybe you are looking for
-
I have recieved an iopd classic 30gb, and it is not turning on. I am stuck at a black screen with a very faint apple logo in the center. When I try to reset, the screen goes blank for a second then goes back to the same screen. I really want to fix i
-
How do I remove the menu button? The Customize option doesn't seem to work for that.
How do I remove the menu button? [That IChing looking three line icon on the toolbar.] The toolbar Customize option doesn't seem to work, and it seems a waste to have a button that duplicates the menus. I'd like to swap it out for the NoScript icon.
-
Hi, I got a paper document called "security deposit refund" and I guess, I'm getting back the amount of $411.51 for having paid on time the whole year. What do I do with this? Do I go to the bank and get the money or go to Verizon Wireless store? I'm
-
Moving Files with multiple HD's
Don't know the best place to put this. I just installed a 1TB HD in my Mac Pro. I was gonna use this drive for all my media files; Itunes, Iphoto, Illustrator and Photoshop, Word, etc. How do I setup to make all these programs save to my new hard dri
-
I can't figure out where to put a method in a jsp page so that I can call it recursively. Tomcat keeps returning "Not expecting variable declaration here and pointing to the "private void methodname(..){" line. I know it probably something basic but