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
Thanks
The 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.
Similar Messages
-
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 external table from an existing database table ?
Hi everyone,
As i understand, its possible to create a new table based on an existing table without copying any values from it, using the following command;
CREATE TABLE newtable AS
(SELECT * FROM oldtable WHERE 1=2);
I would like to know whether we can do a similar thing with external tables. That is to create an external table with the same columns as of an existing table.
Thanks in advance for your answers.You need to clear conception about external table.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/utility.htm#sthref1800
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm#sthref2448 -
Need help in Creating External Tables
Hi All,
I have a flat file containing numberic data, CLOB data, and also date columns data. I have to load this flat file data into staging server table using External tables. I have to write a stored procedure in such way creating exteranl tables dynamically. My question or need help from you people is that how to define the external table to load the CLOB data from flat file.
Thanks,
SankarThe LOCATION clause of an external table specifies the file or files to be read when the table is queried. You can change it to refer to different files without dropping and recreating the table and invalidating all dependent code.
Regarding DBMS_SQL, yes you can do it the hard way if you prefer.
Good point about CLOB columns in external tables. Quite possibly they are not supported, but I would have to check the manuals and try some examples. -
How to create internal table dynamically based on a table entry
hi Experts,
I have table yprod_cat. It has product categories.
In my ABAP program I need to create internal table dynamically based on the number of entries in the table.
For example:
If the table has 3 entries for product category
1. Board
2. Micro
3. Syst
Then create three (3) internal tables.
i_board
i_micro
i_syst
How can we do this? Any sample code will be very usefull
Thanks & Regards
Gopal
Moderator Message: No sample codes can be given. Please search for them or work it!
Edited by: kishan P on Jan 19, 2011 4:22 PMOur APEX version is 4.2We are using below SQL query to display radio groups dynamically..
SELECT APEX_ITEM.RADIOGROUP (1,deptno,'20',dname) dt
FROM dept
ORDER BY 1;
Created a form using SQL type and given abouve SQL query as source.. But when we run the page, there were no radio groups displayed in the page..
Below is the output of the query..
<input type="radio" name="f01" value="10" />ACCOUNTING
<input type="radio" name="f01" value="20" checked="checked" />RESEARCH
<input type="radio" name="f01" value="30" />SALES
<input type="radio" name="f01" value="40" />OPERATIONS
>
If Tabular Form:
Edit Region > Report Attributes > Edit Column > Change the Column type to "Standard Report Column"
If normal Page Item:
Edit Page Item > Security > Escape special characters=No.
Pl read the help on that page item to understand the security risk associated with =NO.
Cheers,
Edited by: Prabodh on Dec 3, 2012 5:59 PM -
Create a Table Dynamically in WEB Dynpro Java with diferent type of column
Hi everyone, I have a question if is possible to create a table dynamically in Web Dynpro Java?, depending of the RFC consults create the rows dynamically, ,this table must have diferent type of columns, for example link column (when the user click this link execute an action and show a adobe interactive form in another view), image column (show an image depending of the information)
Thank you everyone
Atte IsraelHello,Israel.
Yes , it is possible through dynamic programming in wdModify of the View.
You can do this ,for example, using cell variants.
IWDTable tab = (IWDTable) view.getElement("TABLE_NAME");
IWDTableStandardCell cellV= (IWDTableStandardCell) view.createElement(IWDTableStandardCell.class,"TableStandardCell"+i);
cellV.setVariantKey("NotEditableVariant");
cellV.setCellDesign((WDTableCellDesign)wdContext.nodeTableDaysTitle().currentTableDaysTitleElement().getAttributeValue("CellDesign"+i));
IWDTextView textViewi= (IWDTextView) view.createElement(IWDTextView.class,"TextView"+i); // -- here you control the type of the object that is displayed in the cell
textViewi.bindText(dayAttrib);
cellV.setEditor(textViewi);
tabColumn.addCellVariant(cellV);
tab.addGroupedColumn(tabColumn,tab.numberOfGroupedColumns());
Using this code you can control even specific cells in the table and not only columns.
Hope this helps you,
Constantine -
Create external table in procedure
i have a PL/SQL Block [ well i'm not created procedure still]
/* Formatted on 2011/01/05 11:53 (Formatter Plus v4.8.8) */
DECLARE
-- create header
p_formula_no VARCHAR2 (200);
p_formula_vers NUMBER;
p_formula_desc VARCHAR2 (200);
p_formula_desc2 VARCHAR2 (200);
p_formula_class VARCHAR2 (200);
p_owner_organization_id NUMBER;
p_owner_id NUMBER;
p_formula_type NUMBER;
p_scale_type NUMBER;
p_text_code NUMBER;
p_last_update_date DATE;
p_auto_product_calc VARCHAR2 (200);
x_formula_id NUMBER;
x_return_code VARCHAR2 (200);
x_error_msg VARCHAR2 (200);
formula_id NUMBER;
-- update header
p_formula_id NUMBER;
p_formula_status VARCHAR2 (200);
p_user_id NUMBER;
p_last_update_date_orig DATE;
p_formulaline_id NUMBER;
p_line_type NUMBER;
p_line_no NUMBER;
p_item_id NUMBER;
p_item_no VARCHAR2 (200);
p_revision VARCHAR2 (200);
p_qty NUMBER;
p_item_um VARCHAR2 (200);
p_release_type NUMBER;
p_scrap_factor NUMBER;
p_cost_alloc NUMBER;
p_phantom_type NUMBER;
p_rework_type NUMBER;
p_tp_formula_id NUMBER;
p_iaformula_id NUMBER;
p_scale_uom VARCHAR2 (200);
p_contribute_step_qty_ind VARCHAR2 (200);
p_contribute_yield_ind VARCHAR2 (200);
p_scale_multiple NUMBER;
p_scale_rounding_variance NUMBER;
p_rounding_direction NUMBER;
p_by_product_type VARCHAR2 (200);
p_prod_percent NUMBER;
-- create header and update header cursors
CURSOR c1
IS
SELECT DISTINCT formula_no, formula_ver, formula_desc, formula_class,
owner_header
FROM api_formula;
-- for product cursors
CURSOR c2
IS
SELECT *
FROM api_formula
WHERE line_type = 1;
-- for ingredient cursors
CURSOR c3
IS
SELECT *
FROM api_formula
WHERE line_type = -1;
hdr c1%ROWTYPE;
prod c2%ROWTYPE;
ing c3%ROWTYPE;
BEGIN
-- for create and update header
OPEN c1;
FETCH c1
INTO hdr;
WHILE c1%FOUND
LOOP
p_formula_no := hdr.formula_no;
p_formula_vers := hdr.formula_ver;
p_formula_desc := hdr.formula_desc;
p_formula_desc2 := NULL;
p_formula_class := hdr.formula_class;
p_owner_organization_id := 327;
p_owner_id := 1298;
p_formula_type := 0;
p_scale_type := 0;
p_text_code := 0;
p_last_update_date := SYSDATE;
p_auto_product_calc := 'Y';
x_formula_id := NULL;
x_return_code := NULL;
x_error_msg := NULL;
apps.gmd_formula_designer_pkg_cust.create_formula_header
(p_formula_no,
p_formula_vers,
p_formula_desc,
p_formula_desc2,
p_formula_class,
p_owner_organization_id,
p_owner_id,
p_formula_type,
p_scale_type,
p_text_code,
p_last_update_date,
p_auto_product_calc,
x_formula_id,
x_return_code,
x_error_msg
COMMIT;
SELECT formula_id
INTO formula_id
FROM fm_form_mst_b
WHERE formula_no = hdr.formula_no;
p_formula_id := formula_id;
p_formula_no := NULL;
p_formula_vers := NULL;
p_formula_desc := NULL;
p_formula_desc2 := NULL;
p_formula_status := 700;
p_formula_class := NULL;
p_owner_organization_id := 327;
p_owner_id := 1298;
p_formula_type := 0;
p_scale_type := 0;
p_text_code := NULL;
p_last_update_date := SYSDATE;
p_user_id := 1298;
p_last_update_date_orig := SYSDATE;
p_auto_product_calc := 'Y';
x_return_code := NULL;
x_error_msg := NULL;
apps.gmd_formula_designer_pkg_cust.update_formula_header
(p_formula_id,
p_formula_no,
p_formula_vers,
p_formula_desc,
p_formula_desc2,
p_formula_status,
p_formula_class,
p_owner_organization_id,
p_owner_id,
p_formula_type,
p_scale_type,
p_text_code,
p_last_update_date,
p_user_id,
p_last_update_date_orig,
p_auto_product_calc,
x_return_code,
x_error_msg
DBMS_OUTPUT.put_line (x_return_code);
DBMS_OUTPUT.put_line (x_error_msg);
COMMIT;
-- for PROD
OPEN c2;
FETCH c2
INTO prod;
WHILE c2%FOUND
LOOP
p_formula_id := formula_id;
p_formulaline_id := NULL;
p_line_type := 1;
p_line_no := prod.line_no;
p_item_id := prod.item_id;
p_item_no := prod.item_name;
p_revision := NULL;
p_qty := prod.qty;
p_item_um := prod.uom;
p_release_type := 0;
p_scrap_factor := 0;
p_scale_type := 1;
p_cost_alloc := 1;
p_phantom_type := 0;
p_rework_type := NULL;
p_text_code := NULL;
p_tp_formula_id := NULL;
p_iaformula_id := NULL;
p_scale_uom := NULL;
p_contribute_step_qty_ind := NULL;
p_contribute_yield_ind := NULL;
p_scale_multiple := NULL;
p_scale_rounding_variance := NULL;
p_rounding_direction := NULL;
p_by_product_type := NULL;
p_last_update_date := SYSDATE;
p_user_id := 1298;
p_prod_percent := NULL;
x_return_code := NULL;
x_error_msg := NULL;
apps.gmd_formula_designer_pkg.insert_formula_detail
(p_formula_id,
p_formulaline_id,
p_line_type,
p_line_no,
p_item_id,
p_item_no,
p_revision,
p_qty,
p_item_um,
p_release_type,
p_scrap_factor,
p_scale_type,
p_cost_alloc,
p_phantom_type,
p_rework_type,
p_text_code,
p_tp_formula_id,
p_iaformula_id,
p_scale_uom,
p_contribute_step_qty_ind,
p_contribute_yield_ind,
p_scale_multiple,
p_scale_rounding_variance,
p_rounding_direction,
p_by_product_type,
p_last_update_date,
p_user_id,
p_prod_percent,
x_return_code,
x_error_msg
DBMS_OUTPUT.put_line (x_return_code);
DBMS_OUTPUT.put_line (x_error_msg);
COMMIT;
FETCH c2
INTO prod;
END LOOP;
-- for ing
OPEN c3;
FETCH c3
INTO ing;
WHILE c3%FOUND
LOOP
p_formula_id := formula_id;
p_formulaline_id := NULL;
p_line_type := -1;
p_line_no := ing.line_no;
p_item_id := ing.item_id;
p_item_no := ing.item_name;
p_revision := NULL;
p_qty := ing.qty;
p_item_um := ing.uom;
p_release_type := 0;
p_scrap_factor := 0;
p_scale_type := 1;
p_cost_alloc := 1;
p_phantom_type := 0;
p_rework_type := NULL;
p_text_code := NULL;
p_tp_formula_id := NULL;
p_iaformula_id := NULL;
p_scale_uom := NULL;
p_contribute_step_qty_ind := NULL;
p_contribute_yield_ind := NULL;
p_scale_multiple := NULL;
p_scale_rounding_variance := NULL;
p_rounding_direction := NULL;
p_by_product_type := NULL;
p_last_update_date := SYSDATE;
p_user_id := 1298;
p_prod_percent := NULL;
x_return_code := NULL;
x_error_msg := NULL;
apps.gmd_formula_designer_pkg.insert_formula_detail
(p_formula_id,
p_formulaline_id,
p_line_type,
p_line_no,
p_item_id,
p_item_no,
p_revision,
p_qty,
p_item_um,
p_release_type,
p_scrap_factor,
p_scale_type,
p_cost_alloc,
p_phantom_type,
p_rework_type,
p_text_code,
p_tp_formula_id,
p_iaformula_id,
p_scale_uom,
p_contribute_step_qty_ind,
p_contribute_yield_ind,
p_scale_multiple,
p_scale_rounding_variance,
p_rounding_direction,
p_by_product_type,
p_last_update_date,
p_user_id,
p_prod_percent,
x_return_code,
x_error_msg
DBMS_OUTPUT.put_line (x_return_code);
DBMS_OUTPUT.put_line (x_error_msg);
COMMIT;
FETCH c3
INTO ing;
END LOOP;
FETCH c1
INTO hdr;
END LOOP;
DBMS_OUTPUT.put_line (p_formula_id);
DBMS_OUTPUT.put_line (x_return_code);
DBMS_OUTPUT.put_line (x_error_msg);
END;in this PL/SQL Block i'm used external table which is "API_FORMULA"
the coding is
create table api_formula
( FORMULA_NO varchar2(2000),
FORMULA_VER NUMBER,
FORMULA_DESC varchar2(2000),
FORMULA_CLASS varchar2(2000),
ORG NUMBER,
OWNER_HEADER NUMBER,
LINE_TYPE NUMBER,
LINE_NO NUMBER,
ITEM_ID NUMBER,
ITEM_NAME VARCHAR2(2000),
QTY NUMBER,
UOM VARCHAR2(200),
SCRAP_FAC NUMBER,
SCRAP_TYPE NUMBER,
UPDATE_DATE date,
OWNER_LINE NUMBER,
testt char(2)/*,
future_use varchar2(200)*/
organization external
( default directory ZAFAR
access parameters
( records delimited by newline
fields terminated by ','
location ('HEADER.csv')
reject limit 100
;i want this create external table statment in my Pl/SQL Block and when all the execution is complete then drop the table
how it is possible??
regard
chintoouser11156570 wrote:
@BluShadow
ok .. i want to delete all rows from table in the end when execute this PL/SQLdelete all rows from what table?
If you're referring to the external table, it's a file on the filesystem, you don't delete rows from it, you just replace/overwrite/delete the file as and when necessary.
blushadow how i crate a reliable code.. can u suggest me?Basics of transactions... you commit when a business rule/process is complete, not for every little technical thing your code does. In your case I would expect a single commit at the end of the code.
I don't have your tables, data or know what the code is supposed to be achieving, but you can bet your bottom dollar that if you're nesting cursor loops within each other then the code is running much slower than if you generated the data from a single SQL statement/cursor. I certainly have no clue what those procedure calls are doing, but it looks like they're using a load of OUT parameters. Are they user defined procedures or something that's part of e.g. Oracle Apps? If they're user defined I would consider redesigning all the code to use functions and pass back a structured data type with the required data. -
Error while creating external table
Hi i tried to create external table. The table is created but while selecting that table it is throwing below errors
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Countries1.txt in EXT_TABLES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19I've created temp directory in window under oracle directory " C:\oracle\product\10.2.0\temp"
In the temp directory i've a text file countries1.txt
the text file has the below information
ENG,England,English
SCO,Scotland,English
IRE,Ireland,English
WAL,Wales,WelshI've connected to system user and created one directory and granted the read and write permissions to user SCOTT.
SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp\';
Directory created.
SQL> grant read,write on directory ext_tables to scott;
Grant succeeded.The creation of external table query is
CREATE TABLE countries_ext (
country_code VARCHAR2(5),
country_name VARCHAR2(50),
country_language VARCHAR2(50)
ORGANIZATION EXTERNAL (
TYPE ORACLE_LOADER
DEFAULT DIRECTORY ext_tables
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY ','
MISSING FIELD VALUES ARE NULL
country_code CHAR(5),
country_name CHAR(50),
country_language CHAR(50)
LOCATION ('Countries1.txt')
PARALLEL 5
REJECT LIMIT UNLIMITED;And the error is
SQL> select *from countries_ext;
select *from countries_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Countries1.txt in EXT_TABLES not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
SQL> Please help me in thisYou are missing something. Most probably the file does not exists in your specified path. This is working in my 10.2.0.3
Step1: Check the file is actually there.
C:\oracle\product\10.2.0>mkdir temp
C:\oracle\product\10.2.0>cd temp
C:\oracle\product\10.2.0\temp>dir
Volume in drive C is C_Drive
Volume Serial Number is 8A93-1441
Directory of C:\oracle\product\10.2.0\temp
07/30/2011 12:00 PM <DIR> .
07/30/2011 12:00 PM <DIR> ..
07/30/2011 12:00 PM 79 countries1.txt
1 File(s) 79 bytes
2 Dir(s) 50,110,582,784 bytes free
C:\oracle\product\10.2.0\temp>type countries1.txt
ENG,England,English
SCO,Scotland,English
IRE,Ireland,English
WAL,Wales,Welsh
C:\oracle\product\10.2.0\temp>Step 2: Creating the directory object.
SQL> show user
USER is "SYS"
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
SQL> create or replace directory ext_tables as 'C:\oracle\product\10.2.0\temp';
Directory created.
SQL> grant read,write on directory ext_tables to scott;
Grant succeeded.
SQL>Step 3: Table definition.
C:\>sqlplus scott@orclsb/tiger
SQL*Plus: Release 10.1.0.4.2 - Production on Sat Jul 30 12:04:24 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> CREATE TABLE countries_ext (
2 country_code VARCHAR2(5),
3 country_name VARCHAR2(50),
4 country_language VARCHAR2(50)
5 )
6 ORGANIZATION EXTERNAL (
7 TYPE ORACLE_LOADER
8 DEFAULT DIRECTORY ext_tables
9 ACCESS PARAMETERS (
10 RECORDS DELIMITED BY NEWLINE
11 FIELDS TERMINATED BY ','
12 MISSING FIELD VALUES ARE NULL
13 (
14 country_code CHAR(5),
15 country_name CHAR(50),
16 country_language CHAR(50)
17 )
18 )
19 LOCATION ('Countries1.txt')
20 )
21 PARALLEL 5
22 REJECT LIMIT UNLIMITED;
Table created.
SQL> SELECT * FROM countries_ext;
COUNT COUNTRY_NAME
COUNTRY_LANGUAGE
ENG England
English
SCO Scotland
English
IRE Ireland
English
COUNT COUNTRY_NAME
COUNTRY_LANGUAGE
WAL Wales
Welsh -
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.
JohnFYI: 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????? -
How to create a table dynamically
Hello All,
I want to create a table dynamically in DDIC. I know that there is function module exist DB_CREATE_TABLE but i am getting some errors while using it.
Could any please post some code for it.
Regards,
LisaHere is the code i have writen my self.
PARAMETERS: tabname TYPE dd02l-tabname,
fldname TYPE dd03p-fieldname,
rollname TYPE dd03p-rollname.
DATA: gt_cl_bc_dyn TYPE REF TO zcl_bc_dyn,
status TYPE sy-subrc.
data: lct_table type ZTT_ZTSITAB.
INITIALIZATION.
tabname = 'ZTEST1'.
CREATE OBJECT gt_cl_bc_dyn.
START-OF-SELECTION.
CALL METHOD gt_cl_bc_dyn->create_table
EXPORTING
tabname = tabname
fieldname = fldname
rollname = rollname
itab = lct_table
IMPORTING
status = status .
IF status = 0.
WRITE: 'Table creation is successful'.
ELSE.
WRITE: 'Table creation is unsuccessful'.
ENDIF.
Code in the method
METHOD create_table.
DATA: ls_dd02v_wa TYPE dd02v,
ls_dd09l_wa TYPE dd09l,
ls_dd03p TYPE dd03p,
lt_dd03p TYPE TABLE OF dd03p,
rc TYPE sy-subrc.
ls_dd02v_wa-tabname = tabname.
ls_dd02v_wa-tabclass = 'TRANSP'.
ls_dd02v_wa-contflag = 'A'.
ls_dd09l_wa-tabname = tabname.
ls_dd09l_wa-tabkat = '0'.
ls_dd09l_wa-tabart = 'APPL0'.
ls_dd03p-tabname = tabname.
ls_dd03p-fieldname = fieldname.
ls_dd03p-position = '0001'.
ls_dd03p-keyflag = 'X'.
ls_dd03p-rollname = rollname.
APPEND ls_dd03p TO lt_dd03p.
CALL FUNCTION 'DDIF_TABL_PUT'
EXPORTING
name = tabname
dd02v_wa = ls_dd02v_wa
dd09l_wa = ls_dd09l_wa
TABLES
dd03p_tab = lt_dd03p
EXCEPTIONS
tabl_not_found = 1
name_inconsistent = 2
tabl_inconsistent = 3
put_failure = 4
put_refused = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'DDIF_TABL_ACTIVATE'
EXPORTING
name = tabname
IMPORTING
rc = rc
EXCEPTIONS
not_found = 1
put_failure = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
status = rc.
ENDMETHOD. -
Plese Help...i have to create a table dynamically using JSP
Hi all,
Depending upon what user fills as year & month I have to create a table dynamically.The table should look like this...
DAY S M T W
DATE 1 2 3 4
Name1 - - - -
Name2 - - - -
I know how to get total no available days of any month so i'll use for loop to create <tr>
The info i need is-
How to get the first day of the month ,the user entered using calendar because the first row should start with it.
and the second thing is...
How to keep incrementing it in the loop..like after sun-->mon-->tue....sat-->sun....
& also..sat & sun cols should be of different colors than other weekdays
Please help me.Sounds like you already knows about the Calendar class. You should use that class to get the first day of the month.
Kaj -
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 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
Maybe you are looking for
-
Find button on toolbar won't search current page
Post Author: sarasew13 CA Forum: .NET I'm having an issue with the Find button on the standard report viewer toolbar for ASP. When I enter a search term and click on find, it starts searching on the next page even though there are entries (several)
-
How to change SAP host IP?
Hi, All I want to change SAP host 's IP, the SAP system are installed as a Central System, Usage Type: application server abap enterprise portal business intelligence application server java ep core windows server 2003 x64, oracle 10g Which configura
-
Help using C# application to connect to oracle database
I'm new to database. I'm developing a C# GUI application in visual studio 2008 that is suppose to interact with oracle. After researching and trying out several sample codes, nothing works and I'm in desperate need of some help/advice/suggestions. Th
-
ITunes Link On Web Won't Open In iTunes
All of a sudden when I click on a link on the web for an app, etc. that's supposed to open up the description on itunes, it doesn't work. I tried uninstalling and reinstalling iTunes and it still doesn't solve the problem. I'm running Windows 8 and h
-
Transferring RAW photos from an iTouch back to my Mac
My iMac recently bogged out on me. I have no idea what happened. Nonetheless everything was wiped clean from it. Luckily, I was able to salvage some of my stuff (music, videos etc) from my iTouch using TouchCopy. However, my iTouch has about 800 or s