473,750 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

External Table Query runs in PL/SQL but fails in perl script

2 New Member
Hey Guys,

I am trying to automate the process of loading data in our oracle server. As a part of that process, I am working on a perl script that loads external tables from data files. What I am seeing is that I get following error when I select from external table created using script.

ORA-29913: error in executing ODCIEXTTABLEOPE N callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier ": expecting one of: "number, plussign"
KUP-01008: the bad identifier was p8
KUP-01007: at line 7 column 23
ORA-06512: at "SYS.ORACLE_LOA DER", line 19

The thing is that if print out the query string to a text file and run the query inside PL/SQL, the external table is created and I can select from it without any errors. its only when perl executes the query that the above error rears its ugly head.

The code in the script is:

Expand|Select|Wrap|Line Numbers
  1. $str_sql = "CREATE TABLE acnhs.bi_load_$year"."$quarter                 (                   cust_num varchar(255),                   date_id varchar(255),                   outlet_cde varchar(255),                   upc_cde varchar(255),                   units varchar(255),                   net_dlr varchar(255),                   ret_disc varchar(255),                   mfr_disc varchar(255)                   )                 ORGANIZATION external                  (                   TYPE oracle_loader                   DEFAULT DIRECTORY acn_load_test                   ACCESS PARAMETERS                    (                     RECORDS DELIMITED BY 0X\'0A\'                     READSIZE 1048576                     FIELDS LRTRIM                     MISSING FIELD VALUES ARE NULL                      REJECT ROWS WITH ALL NULL FIELDS                      (                       cust_num (1:8),                       date_id (9:14),                       outlet_cde (15:18),                       upc_cde (19:30),                       units (31:32),                       net_dlr (33:37),                       ret_disc (38:41),                       mfr_disc (42:45)                     )                   )                   location                    ($file_string)                 )REJECT LIMIT UNLIMITED";
The SQL generated by the script is:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE acnhs.bi_load_08Q2                 (                   cust_num varchar(255),                   DATE_ID varchar(255),                   outlet_cde varchar(255),                   UPC_cde varchar(255),                   units varchar(255),                   net_dlr varchar(255),                   ret_disc varchar(255),                   mfr_disc varchar(255)                   )                 ORGANIZATION external                  (                   TYPE oracle_loader                   DEFAULT DIRECTORY acn_load_test                   ACCESS PARAMETERS                    (                     RECORDS DELIMITED BY 0X'0A'                     READSIZE 1048576                     FIELDS LRTRIM                     MISSING FIELD VALUES ARE NULL                      REJECT ROWS WITH ALL NULL FIELDS                      (                       cust_num (1:8),                       DATE_ID (9:14),                       outlet_cde (15:18),                       UPC_cde (19:30),                       units (31:32),                       net_dlr (33:37),                       ret_disc (38:41),                       mfr_disc (42:45)                     )                   )                   location                    ('PD_1','PD_2')                 )REJECT LIMIT UNLIMITED

Any thoughts as to what I could be doing wrong?

Thanks,

Ashish
Jun 26 '08 #1
3 4048
debasisdas
8,127 Recognized Expert Expert
please find a related article here.
Jun 27 '08 #2
tundal45
2 New Member
Thanks for the reply. I guess I was not clear in my last post. I have the SQL code for the external table that works fine if I run it manually in PL/SQL. What I am trying to do is to automate the process and run the query through perl and for some reason the same query (that runs in Pl/SQL) causes an error (described in the previous post) when executed using Perl. Does anyone know why this is happening? (the Perl code that I use can be found in my previous post as well)
Jun 27 '08 #3
amitpatel66
2,367 Recognized Expert Top Contributor
Thanks for the reply. I guess I was not clear in my last post. I have the SQL code for the external table that works fine if I run it manually in PL/SQL. What I am trying to do is to automate the process and run the query through perl and for some reason the same query (that runs in Pl/SQL) causes an error (described in the previous post) when executed using Perl. Does anyone know why this is happening? (the Perl code that I use can be found in my previous post as well)
What is the error that it is throwing?
Jun 30 '08 #4

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

Similar topics

15
2666
by: Xah Lee | last post by:
Here's the belated Java solution. import java.util.List; import java.util.ArrayList; import java.lang.Math; class math { public static List range(double n) { return range(1,n,1); }
7
6218
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to make it better soon. Unfortunately, there is never a non-crucial time in which we can do an upgrade, so we are stuck for now. Point 1: There are multiple tables: students, courses, cross-reference
7
5404
by: Jon Combe | last post by:
I have created the following test SQL code to illustrate a real problem I have with some SQL code. CREATE TABLE JCTable ( CustomerName varchar(50) ) ALTER TABLE JCTable ADD CustomerNo int INSERT INTO JCTable ( CustomerName , CustomerNo ) VALUES ( 'Jon Combe' , 1 ) INSERT INTO JCTable ( CustomerName , CustomerNo ) VALUES ( 'Bill Gates' , 1 ) UPDATE JCTable SET CustomerNo = 2 WHERE CustomerName = 'Jon Combe'
6
1863
by: Harlan Messinger | last post by:
When a table has multiple layers of column and/or row headings, as we know, there are a couple of options for making the table accessible. Using a *scope* attribute is fine as long as the number of column levels or row levels doesn't exceed two, since you can only specify "col" and "colgroup" as scope values in the former case, and "row" or "rowgroup" in the latter. Then there's the use of *id*, *headers*, and *axis*. For most purposes, I...
1
3338
by: Martin_Hurst | last post by:
Is it possible to establish a connection from within a postgres database to another external database on the network, i.e., not a java or scripting connection, BUT by some type of table definition within the postgres database of that external database table source - something similar to a proxy definition. Examples of external database could be MSAccess, Oracle, Sybase, MSQLServer, etc. The idea behind this would to be able to at least...
11
4609
by: Hemant Shah | last post by:
Folks, I have a perl script that creates and uses global termporary table. This script worked fine with UDB 7.2 on AIX. Sometime ago I moved the database to UDB 8 on Linux. The select statement that used to take less than a minute now take 10 minutes. Do I have to tune something on Linux and/or DB2? I tried two different ways to create temporary tablespace but both of them give same slow performance:
3
5335
by: ghadley_00 | last post by:
Hi, Does anyone know of a way I can write a script that imports a table from a particular .mde file? I don't seen any obvious way to do it as a macro. Any suggestions if it can be done as a macro or as a written module? My ultimate goal is to have script that clears info out of 1 table in an .mdb file, imports an identically structured table from a .mde file, runs an append query I have in place to copy the data from the imported
2
1685
by: praveenTNQ | last post by:
Hi, I am facing a problem in my perl cgi page. The External JS "<script language="JavaScript" src="/js/menu.js"></script>" is not running in FIrefox but it runs in IE by apache server. Note: As a HTML file it runs in Firefox Also.
7
10291
by: gregp1 | last post by:
Hi guys, Here's the code I'm to refer to: <html> <body> .... <form method="get" action="http://www.google.com/search" name="google" />
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9397
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9344
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4893
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.