Creating external Tables using the EXECUTE IMMEDIATE in PL/SQL
Hi guys,.I am trying to create an external Table using the EXECUTE IMMEDIATE in a procedure and I managed to compile and no errors were generated. But when I try to run it from sql using the exec command I get the following error:
------------------------------------------------------------------------
ERROR on line 5:
ORA-00911: invalid character
ORA-06512: at "GEO. TEST_DDL', line 4
ORA-06512: at line 5
-------------------------------------------------------------------------
I tried to check the whole statement to create the external table, but I can't find where is the error. Surprisingly, if I simply run the command table create external on sqlplus it works, but not a procedure.
If anyone can help with ideas or experience?
Geoffrey Kossami
The error means that there is an identifier somewhere that starts with a nonalphanumeric. This is a typical mistake of editing. A procedure compiles correctly is not of course because the underlying dynamic sql running is OK. Which of course only be resolved when you try to run it.
There is certainly a problem with the text you provide to be run as a piece of dynamic sql code. You should try to watch it with dbms_output and run this code in sqlplus. But your problem is with the code you run as dynamic PL/SQL, it is not itself compilable.
Jack
Tags: Database
Similar Questions
-
Get the 500 error trying to create a table using the REST API
Hello
I tried to create a table using the REST API for Business Intelligence Cloud, but I got 500 Internal Server Error for a while now.
Here are the details that I use to create a table.
and the json to create the schema that I use is
[{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [18], 'columnName': ["ROWID"]}]
, {'Nullable': [true], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [18], 'columnName': ['RELATIONID']},
{'Nullable': [true], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [18], 'columnName': ['ID']}
, {'Nullable': [true], 'defaultValue': 'dataType' [null],: ['TIMESTAMP'], 'precision': [0], 'length': [0], 'columnName': ['RESPONDEDDATE']},
{'Nullable': [true], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [255], 'columnName': ['RESPONSE']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['TIMESTAMP'], 'precision': [0], 'length': [0], 'columnName': ['SYS_CREATEDDATE']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [18], 'columnName': ['SYS_CREATEDBYID']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['TIMESTAMP'], 'precision': [0], 'length': [0], 'columnName': ['SYS_LASTMODIFIEDDATE']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [18], 'columnName': ['SYS_LASTMODIFIEDBYID']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['TIMESTAMP'], 'precision': [0], 'length': [0], 'columnName': ['SYS_SYSTEMMODSTAMP']},
{'Nullable': [false], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [10], 'columnName': ['SYS_ISDELETED']},
[{'Nullable': [true], 'defaultValue': 'dataType' [null],: ['VARCHAR'], 'precision': [0], 'length': [50], 'columnName': ['TYPE']}]
I tried this using postman and code, but I always get the following response error:
Error 500 - Internal server error
Of RFC 2068 Hypertext Transfer Protocol - HTTP/1.1:
10.5.1 500 internal Server Error
The server encountered an unexpected condition which prevented him from meeting the demand.
I am able to 'get' existing table schemas, delete the tables, but I'm not able to make put them and post operations. Can someone help me to identify the problem, if there is no fault in my approach.
Thank you
Romaric
I managed to create a table successfully using the API - the only thing I see in your JSON which is different from mine is that you have square brackets around your values JSON where I have not. Here is my CURL request and extract my JSON file (named createtable.txt in the same directory as my CURL executable):
curl u [email protected]: password UPDATED h x ' X-ID-TENANT-NAME: tenantname ' h ' Content-Type: application/json '-binary data @createtable.txt https://businessintell-tenantname.analytics.us2.oraclecloud.com/dataload/v1/tables/TABLE_TO_CREATE k
[
{
'columnName': 'ID',
'dataType': 'DECIMAL ',.
'Length': 20,.
"accuracy": 0.
'Nullable': false
},
{
'columnName': 'NAME',
'dataType': 'VARCHAR ',.
'Length': 20,.
"accuracy": 0.
'Nullable': true
},
{
"columnName': 'STATUS."
'dataType': 'VARCHAR ',.
'Length': 20,.
"accuracy": 0.
'Nullable': true
},
{
"columnName': 'CREATED_DATE."
'dataType': 'TIMESTAMP '.
'Length': 20,.
"accuracy": 0.
'Nullable': true
},
{
'columnName': 'UPDATED_DATE ',.
'dataType': 'TIMESTAMP '.
'Length': 20,.
"accuracy": 0.
'Nullable': true
}
]
-
Creating a table using the Select statement of the physical layer
Hello
I use 10G, and I have the sub query in my physical layer. I chose the type of Table as Select and gave the SQL below. When I say the number of lines of update updates lines 93, that is correct, but does not show me the columns, or when I say display data, it does not show me the data, please see if I'm doing something worng. Thanks for your time and your help.
Select (select program_id, project, actvty_id, commitment_date, row_number() over (partition by order project by commitment_date desc) as rnk project, actvty_id, program_id, commitment_date)
of project_detail) a
where rnk = 1Yes, create columns individually and click view data, you'll be able to get data
-
Pass Pl/sql table in the USING clause in the EXECUTE IMMEDIATE statement
Getting error when I try to pass the PL/SQL table in the USING clause in the EXECUTE IMMEDIATE statement:
Declare
result NUMBER;
TYPE values_tab IS TABLE OF NUMBER INDEX OF directory;
lv_tab values_tab;
lv_exp varchar2 (300);
lv_exec varchar2 (300);
BEGIN
lv_tab (1): = 5;
lv_tab (2): = 48;
lv_tab (3): = 7;
lv_tab (4): = 6;
lv_exp: = ': + b1: b2 + (: b3 *: b4)';
lv_exec: = 'SELECT'. lv_exp | ' THE DOUBLE '.
IMMEDIATE EXECUTION
lv_exec
IN
result
USING
lv_tab;
DBMS_OUTPUT. Put_line (result);
END;
/
Error on line 1
ORA-06550: line 20, column 12:
PLS-00457: expressions must be SQL types
ORA-06550: line 15, column 8:
PL/SQL: Statement ignored
I am trying to evaluate the expression ': + b1: b2 + (: b3 *: b4) "which is stored in the table. This table has different expressions (expressions about 300). I want to use the bind variable in the expression because each expression evaluated thousands of time may be more in some cases. If I use bind variable can he fill pool.
Is there a way I can pass parameters with the HELP of (IN) dynamically instead of write "help lv_tab (1), lv_tab (2), lv_tab (3), lv_tab (4)? As number of change of the input parameters depend on the expression in the table.
If it is possible please suggest any other ideas/approaches
Help, please...
Published by: satnam on June 11, 2009 11:50Well, you keep changing faster reqs that I can follow. In any case, assuming that N-th variable bind (left to right) corresponds to n-th collection item:
Declare result NUMBER; lv_tab values_tab := values_tab(); lv_exp varchar2(300); lv_exec varchar2(300); lv_i number := 0; BEGIN lv_tab.extend(4); lv_tab(1) := 5; lv_tab(2) := 48; lv_tab(3) := 7; lv_tab(4) := 6; lv_exp := ':5000135+:5403456+(:5900111*:5200456)'; lv_exec := lv_exp; While regexp_like(lv_exec,':\d+') loop lv_i := lv_i + 1; lv_exec := REGEXP_REPLACE(lv_exec,':\d+',':b(' || lv_i || ')',1,1); end loop; lv_exec := 'BEGIN :a := ' || lv_exec || '; END;'; DBMS_OUTPUT.PUT_LINE(lv_exec); EXECUTE IMMEDIATE lv_exec USING OUT result,IN lv_tab; DBMS_OUTPUT.PUT_LINE(result); END; / BEGIN :a := :b(1)+:b(2)+(:b(3)*:b(4)); END; 95 PL/SQL procedure successfully completed. SQL>
SY.
-
need a script to create multiple tables as the other columns in tables
I need script to create multiple tables as the other columns of tables respectively.
lets consider I want to create tables from table1... table99 like tablex1... .tablex99 columns (without data) respectively (i.e table1 as tablex1, table99 as tablex99).declare cursor c is select object_name from all_objects where object_type='TABLE'; begin for i in c loop execute immediate 'create table '||i.object_name||'_x as select * from '||i.object_name||' where 1=2'; end loop; end; use can use this and put your user names accordingly. If you get any error please post the error.
-
External table with the field tab delimiter
With the help of Oracle 11 g Release 2
Here is my table create statement external:
CREATE TABLE global.ext_a_attrib_cmt ( tag VARCHAR2(255) , from$ VARCHAR2(255) , to$ VARCHAR2(255) ) ORGANIZATION EXTERNAL ( TYPE ORACLE_LOADER DEFAULT DIRECTORY EXT_DATA_DIR ACCESS PARAMETERS ( RECORDS DELIMITED BY NEWLINE SKIP 1 BADFILE EXT_BAD_DIR:'a_attrib_cmt.bad' LOGFILE EXT_LOG_DIR:'a_attrib_cmt.log' -- FIELDS TERMINATED BY 0X'09' -- TAB delimited FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY "'" MISSING FIELD VALUES ARE NULL REJECT ROWS WITH ALL NULL FIELDS ) LOCATION ('a_attrib_cmt.txt') ) REJECT LIMIT UNLIMITED NOMONITORING /
Here is the text file, a_attrib_cmt.txt:
tag Of TO FrontSpringType_id Coil w/FRONT COIL SPRINGS FrontSpringType_id Sheet the FRONT/w suspension SPRINGS Aspiration_id Naturally aspirated w/o TURBO Aspiration_id Turbocharged w/TURBO Aspiration_id Supercharged w/COMPRESSOR SteeringType_id Grid w/RACK and PINION STEERING SteeringType_id Gear w/GEAR STEERING FuelDeliveryType_id CARB w/o FUEL INJ FuelDeliveryType_id FI w/FUEL INJ BedLength_id ?" BED BodyNumDoors_id ? DR BrakeSystem_id w / ? BRAKES FrontBrakeType_id w/FRONT? BRAKES PUBLIC has privileges to write to the directory EXT_DATA_DIR.
Here is the error I get:
Globall@ORA1 > select count (*) in the ext_a_attrib_cmt;
Select count (*) in ext_a_attrib_cmt
*
ERROR on line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN legend
ORA-29400: data cartridge error
KUP-00554: error occurred when parsing the access settings
KUP-01005: syntax error: found 'minussign': expected an a: "badfile, bigEndian, characterset, column, data, delimited, discardfile,
disable_directory_link_check, fields, fixed, charge, logfile, language, nodiscardfile, nobadfile, nologfile, date_cache, preprocessor, TailleLue, String, jump,
territory, variable.
KUP-01007: line 5, column 8
Just get rid of the comment line. You cannot cave comments to create external table statement. SY.
-
Update a table using the clause
Hello
I want to update a table using the selected values.
Cases in the sample:
create table as empsalary)
Select 1 as empid, 0 in the wages of all the double union
Select option 2, the double 0);
Data update are as follows
with saldata as
(
Select 1 as empid, 5000 as wages, 500 as double pf
Union of all the
Select option 2, 10000,1000 like double pf
)
Select empid, salary saldata
I tried the following query but does not work
updated set of empsalary table (empid, salary) =
(
Select * from)
with saldata as
(
Select 1 as empid, salary, 500 5000 as pf Union double all the
Select option 2, 10000,1000 like double pf
)
Select empid, salary saldata
) sl
where sl.empid = empsalary.empid
)
I use oracle 10g.
Help, please.
Krishna Devi wrote:
Hello
I want to update a table using the selected values.
Cases in the sample:
create table as empsalary)
Select 1 as empid, 0 in the wages of all the double union
Select option 2, the double 0);
Data update are as follows
with saldata as
(
Select 1 as empid, 5000 as wages, 500 as double pf
Union of all the
Select option 2, 10000,1000 like double pf
)
Select empid, salary saldata
I tried the following query but does not work
updated set of empsalary table (empid, salary) =
(
Select * from)
with saldata as
(
Select 1 as empid, salary, 500 5000 as pf Union double all the
Select option 2, 10000,1000 like double pf
)
Select empid, salary saldata
) sl
where sl.empid = empsalary.empid
)
I use oracle 10g.
Help, please.
Thanks for posting creates table and test data.
The error message would have helped because it's pretty obvious that this is the problem:
Update table empsalary
*
ERROR on line 1:
ORA-00903: invalid table name
Just remove the word "table".
-
Can take us backup of external table using expdp
Can take us backup of the external table using expdp, please suggest any doc.
Thanks in advance.Yes, this works, see this example:
http://www.Oracle.databasecorner.com/resource, 3950,data-movement-with-external-table-and-datapump.aspx
Werner
-
Why and how 'create a profile using the e-mail icon?
When I try to send a screenshot of a web page, and after that I'm going to "email recipient" a small screen appears and tells me that "no profiles have been created. To create a profile use the mail Control Panel icon. What this means and how can I do? I use outlook express and can not send another email, just not screenshots of web pages. UPS used to before. I recently "upgraded" in IE8. Thank you!
Check in Internet Options as your default mail Outlook Express Manager
(The mail applet is to use with Outlook, part of the Office family and completely different from Outlook Express) -
How to create IT strategy using the BES administrator API
Hi all
Can tell me, how to create IT strategy using the BES administrator API.
Please provide me with the code example.
Thanks in advance.
Kind regards
Sampath
Hi Sebastian,.
The Administration of BlackBerry API does not support the creation of it political. This feature is currently with the development of control and review for a future version of the BlackBerry Web Services for the Administration of the company.
Kind regards
-
If I create a form using the free trial software, will I be able to use and access the form, after the trial period is over?
Yes, you can access the project that you created after the trial is over, but you need to back it up.
Concerning
Stéphane
-
link broken->; creating WebLogic domains using the CW
Hello!
Create domains in the Configuration Wizard guides you through the process of creating or
expand a field for your target environment. See Creating WebLogic
Areas using the Configuration Wizard.
This link does not work... any idea where I could find the info?Check this one-> http://download.oracle.com/docs/cd/E13179_01/common/docs102/confgwiz/index.html
http://download.Oracle.com/docs/CD/E13179_01/common/docs102/confgwiz/newdom.html#wp1080587
Published by: Dubois Thomas on October 15, 2009 01:36
-
Using numbers to create a table where the value of the line increases automatically
Hello
I created a table (pictured below) to help calculate my self-employed income:
INDEX
DATE
HAVING RETURNED TO THE SELF-EMPLOYED
£
A1
I want to create an index / of reference for each line so that I can connect to receipts.
I like the index / reference to automatically increase i.e. A2, A3 etc when I create a new line by using the shortcut 'alt - cursor down' but to note has managed to find out what formula to use.
Any help would be great!
Thank you very much
Stophen.
You can try something like this:
= 'A' & rangee()
SG
-
Hi all
I am beginner in Oracle.
I have a two-column table that I use to create a view documents/statement once it meets the qualification.
The table has fields. 1 number and 2. Group. If there is more than 3 records found on this table with the same NUMBER and the GROUP he should create this table view.
Thank you
Pramod Devkate
The training is therefore two lines for a ticket and the agent. When the third row is added, create a line in the summary table. Later a fourth line is added to the table of training for this ticket and the agent, but we do not update the line in the summary table. We only touch the summary table when the third row is added to the training table, then it is only updated by the application. Very well
INSERT INTO summary (ticket, agent, total_travel, total_mtts)
Select ticket agent, sum (travel), sum (mtts)
training
where (ticket, agent) not in
(select the ticket agent summary)
Group ticket, agent
having count (*) > 2.
This inserts in the table only notes and agent ID that do not exist already.
-
How to create the Table using the column Drag and Drop feature
Hello:
I'm new to Data Modeler tool Oracle SQL dev and would like to know if there is a way to create a new table by reusing existing columns or groups of columns. The idea is to maintain consistency and save time of table design. If the columns created previously can be reused and require, drag and drop column in the right pane, then only new columns must be created manually.
Any thoughts on this will be appreciated.
Thank you!Yes - just change the name of the model table in the script (t_name = "table_template") then save this new transformation for later use.
I don't know how to apply only some of the tables. Seems like something you could do to a secondary view level?
Perhaps someone else on the forum can advise how to change the script to work on a subview only instead of the whole model.
Maybe you are looking for
-
I have an extensive collection of emails on a bill that I want to transfer to a USB key.
Is it possible to copy a collection of emails I have in a legal folder to a USB key?
-
Example: Pavl'ln Slimline s5-1: Front USB Ports NOT working
Really need help from the experts here - model desktop HP Pavilion Slimline s5-1: H2M46AA (a Joshua motherboard with H61 Intel Chipset) crashed hard drive and have no original driver. Clean install of Win7 Home Premium SP1. Everything is OK except ot
-
OfficeJet 7612 large format: officejet 7612 windows 8
We recently purchased one of these * monstrosities for our home and it works fine, as long as we do not attempt to print several pages at a time.We organize two identical Windows 8 workstations, connected to the printer via wifi on our network router
-
How can I register for my account in Outlook Express?
Please give me the step by step procedure how to signout my account... my reference is email ID * email is deleted for privacy *. original title: signout in OutLook Express
-
Error 8024402f Windows update after installing service pack 2.
I received the error: 8024402f for windows update after installing service pack 2. I tried to fix it and manual fixation on this website http://support.microsoft.com/kb/836941, but I still receive same error code what do I do? I checked the history u