Sqlldr - passing file as a param
hi,
here is what a line in first.sql looks like:
ho sqlldr userid=usrname/passwd control=file1.ctl log=file2.log direct=true errors=10000
where file1.ctl looks like:
LOAD DATA
INFILE 'file3.txt' "str '\n'"
INTO TABLE table_name
FIELDS TERMINATED BY '\t'
TRAILING NULLCOLS
(sno char(1000),
salary INTEGER EXTERNAL)
Now, if i want to pass file3.txt as a parameter to either first.sql or file1.ctl - how would i do that?
thanks
Hi,
You can save the following sqlldr command in one shell script named first.sh
sqlldr userid=usrname/passwd file=$1 control=file1.ctl log=file2.log direct=true errors=10000
Please change your control file as below
LOAD DATA
INTO TABLE table_name
FIELDS TERMINATED BY '\t'
TRAILING NULLCOLS
(sno char(1000),
salary INTEGER EXTERNAL)
And run the shell script first.sh by passing the source file as argument like below.
./first.sh file3.txt
Note: This is not tested. Please try and let us know if you face any issues.
Thanks,
Karthik
Similar Messages
-
Question about pass file name and path to file write adapter
I need to pass file name and path to file adapter for write. I got partial answers from thread Re: Get File name using File Adapter , but seems InboundHeader_msg or outboundHeader_msg only takes file name, how do I pass file directory?
since I still have to specify file format (like xxx_%xx%.txt) in the file adapter wizard. Will this name conflict with what the name defined in InboundHeader_msg ?
Similarly, how can I pass a file name and path to a file synchread adapter?
Thanks,
Message was edited by:
user531689Just overwrite the filename in the WSDL file that was generated
-
Is there a way to pass files to a LV app in Mac OS X?
There is an option in the Finder in Mac OS X to open files with the specified application. I tried it with my LV app, but unfortunately I haven't found any way to read out the filename passed to the app.
(The Application/Command Line Arguments Property didn't work in this case.)
Has anyone ever tried to pass files to a LV app in Mac OS X? I mean not in the command line but in the Finder.
Thanks in advanceHi,
When I understand this right - and as I am not so much of a MAC Expert - you want to do the following:
1. You are in a file finder, where you can click on files an select: "open with ProgrammXY"
2. That ProgrammXY should be a LabVIEW App you created that can open files for Analysis.
3. The LabVIEW App catches from somewhere the path-string and name of the file that was selected to be opened with your LabVIEWApp, like from some
kind of property node or function.
4. How to do that?
I do not think that is possible, at least I do not know a way to do that in Windows so I doubt there is a way to do that in MAC OS.
<<Anyway, it could even be an empty App, the main question is if it is even possible to get the filename in a LV App if we open it in Finder.
When you cannot configure the Finder in a way so that he writes the file name as a command line parameter in the opening call .- exuse me if that is not MAC vocabulary - I do not see a way how to do this.
Regards
René -
How to pass file reference to c
Hi,
I want to pass file reference pointer to a dll written in visual c++. How can i do that?What do you want to do with that reference in your C code? if you want to access it using OS File IO functions you have to be very careful! You should not mix LabVIEW nodes and OS platforms calls together. It's either one or the other.
If you can guarantee that what you want to do is configure the Call Library Node (CLN) parameter to Adapt To Type. Then right click on the CLN and select "Create C Source Header" or something to that meaning. Save the resulting file to disk. Open it and copy the function prototype into your C/C++ file. There should be a parameter typed LVRefnum *. Now you can use the LabVIEW manager C function MgErr FRefNumToFD(LVRefNum refNum, File *fdp);
You need to link your DLL with labview.lib in the cintools directory in order to be able to call the FRefNumToFD() function. The value in the fdp reference is the platform specific file handle, so for Windows this is a HANDLE.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
is there an option in sqldeveloper to have this (nonlogged) option set in the generated sqlldr .ctl files? thx
Hi,
I confirm there is no OPTION to use the DIRECT mode.
For the simple reason you have restriction in DIRECT mode:
-Cannot load clustered tables.
-There can be no active transactions in the loaded tables.
-There can be no SQL functions used in the control file.
-If the target table is indexed, then no SELECT statements may be issued
against the table during the load.
So if you have a look to the .CTL files, the most part of the time, functions are used to translate datatypes correctly (ex: DECODE,HEXTORAW......)
regards,
Mireille -
I have several files and want to pass them as arguments to a Helper class for further processing. I put the public static void main (String arg[]) {} class and the Helper class in a package.
I got error messages "cannot resolve symbol" for:
1. variable XSLTransformHelper for if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
2. method close() for xmlin.close();
3. method close() for xslin.close();
4. method close() for htmlout.close();
I cannot spot the problems and my code can be seen below:
=====================================
package Transform;
import java.io.*;
public class XSLTransform {
public static void main(String[] args) throws Exception {
//Create a file object with the file name in the argument:
File xmlin = new File("c:/javaprj/RSS.xml");
File xslin = new File("c:/javaprj/RSS.xsl");
File htmlout = new File("c:/javaprj/RSS.html");
if (!XSLTransformHelper.transform(xmlin, xslin, htmlout))
System.err.println("Transformation failed");
else
try {
xmlin.close();
xslin.close();
htmlout.close();
catch(IOException e)
{System.out.println("closing file exception");}
=======================================================
=======================================================
package Transform;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class XSLTransformHelper {
public static boolean transform(String xmlFilename, String xslFilename, String resultFilename) {
try {
TransformerFactory factory = TransformerFactory.newInstance();
Source xmlSource = new StreamSource(new FileInputStream(xmlFilename));
Source xslSource = new StreamSource(new FileInputStream(xslFilename));
Transformer transformer = factory.newTransformer(xslSource);
Result result = new StreamResult(new FileOutputStream(resultFilename));
transformer.transform(xmlSource, result);
return true;
} catch (TransformerFactoryConfigurationError transformerFactoryConfigurationError) {
transformerFactoryConfigurationError.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
return false;
======================================================I have several files and want to pass them as
arguments to a Helper class for further processing. I
put the public static void main (String arg[]) {}
class and the Helper class in a package.
I got error messages "cannot resolve symbol" for:
1. variable XSLTransformHelper for if
(!XSLTransformHelper.transform(xmlin, xslin,
htmlout))
2. method close() for xmlin.close();
3. method close() for xslin.close();
4. method close() for htmlout.close();
I cannot spot the problems and my code can be seen
below:
=====================================
package Transform;
import java.io.*;
public class XSLTransform {
public static void main(String[] args) throws
ws Exception {
//Create a file object with the file name in the
n the argument:
File xmlin = new File("c:/javaprj/RSS.xml");
File xslin = new File("c:/javaprj/RSS.xsl");
File htmlout = new File("c:/javaprj/RSS.html");
if (!XSLTransformHelper.transform(xmlin, xslin,
slin, htmlout))
System.err.println("Transformation failed");
else
try {
xmlin.close();
xslin.close();
htmlout.close();
catch(IOException e)
{System.out.println("closing file
losing file exception");}
=======================================================
=======================================================
package Transform;
import javax.xml.transform.*;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
public class XSLTransformHelper {
public static boolean transform(String
ing xmlFilename, String xslFilename, String
resultFilename) {
try {
TransformerFactory factory =
y factory = TransformerFactory.newInstance();
Source xmlSource = new StreamSource(new
mSource(new FileInputStream(xmlFilename));
Source xslSource = new StreamSource(new
mSource(new FileInputStream(xslFilename));
Transformer transformer =
ansformer = factory.newTransformer(xslSource);
Result result = new StreamResult(new
mResult(new FileOutputStream(resultFilename));
transformer.transform(xmlSource, result);
return true;
} catch (TransformerFactoryConfigurationError
onError transformerFactoryConfigurationError) {
transformerFactoryConfigurationError.printStackTrace()
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
return false;
======================================================I observe that you pass Files as arguments of the method transform while this method is expecting Strings!!!! -
Creating a dynamic sqlldr control file
Hi,
I am in need of creating a dynamic sqlldr control file that will check the flat file, delimiter and load the data in a table. The table is having all the columns but the flat file can vary time to time.
looking forward for your valuable suggestions.
Regards
Rajib.You may want to post more explicit requirements if you want sample code. For example, what the file looks like, what variations are allowed, what variations are disallowed, an example control file that would be output, etc. Specifying the precise language you're using (there are many different shell scripting languages) would also help.
In my experience, though, this sort of thing is almost always a one-off-- examples don't tend to be particularly helpful because every set of requirements tends to be very particular. If you have a full understanding of the requirements, and a decent understanding of your scripting language, I doubt it would take more than half a day to knock something together.
Justin -
Is there any way to pass in JVM tunable params to OC4J containers?
1. Switch to -server rather than -classic
2. Min/Max Memory configuration
3. pass in tunable GC params
Passing parameters to the JVM when executing dcmctl does not pass these variables to the exec-ed java process(OC4J Containers).
Any help is appreciated.
Thanks,
Vamsi NukalaHello
say I like to pass object I created in one page say :
MyObject obj = new MyObject("1","2","3");
via http params (supmit or post ) to other page . and
use it there can it be done ?No. You can however place them as attributes in scope (application/session/request) and retrieve these attributes in the next page.
example
in one page,
session.setAttribute("obj", obj);
in another page
MyObject obj = (MyObject)session.getAttribute("obj");
ram. -
Passing files into BPEL processes
Hi,
I was wondering if it is possible to pass files of different types (.doc, .jpg etc.) into a BPEL process. If so, are there any documentation and/or examples showing how to do this?
Thanksin 2.0.11, the only way to pass files to BPEL processes is to use base64 encoding.
we are looking at providing better support for binary attachment in the 10.1.3 Preview 1 release scheduled for March 05.
Best,
Edwin -
How to pass file name as parameter into url: or fo:external-graphic src
Hello gurus,
In my rtf I want to dynamically get the name of the image file and display the image in the report. If use hard coded image file name it works but if I try to get the name into a variable and pass that variable it is not working.
Basically my client is having different logos for each operating unit. in the OA_MEDIA directory there are separate logos for each OU. during run time based on OU name we need to display the corresponding image. If I can get this entire path($OA_MEDIA/logo.jpg') in XML field<?CF_OU_LOGO?> then I'm able to print the logo using url:{CF_OU_LOGO}
But I'm using seeded data source and I cant modify the data source, I need to handle this in RTF only. I could able to get the file name into a variable but not sure how to pass to url.
could some one help me on this. I tried the following options
<fo:external-graphic src="url($ln)" />
url:{$ln} in web etc...
here 'ln' is the variable which holds '$OA_MEDIA/logo.jpg'. ln is defined as <xsl:variable name="ln" select=".//CF_OPERATING_UNIT" />
later I set the values as <?xdoxslt:set_variable($_XDOCTX, 'ln',translate( concat('${OA_MEDIA}/','Logo',.//CF_OPERATING_UNIT,'.jpg'),' ',''))?><?xdoxslt:get_variable($_XDOCTX, 'ln')?>
thanks,
VijayVijay
What version of EBS is the customer running? I read somewhere that in R12 all of the concurrent parameters are passed to the XMLP template. I have not tried this but if true. You could create a conc program parameter that would hold the location of the image. You could either have the user pick the image or maybe derive it from the other parameter choices.
Lets assume the token name is DLOGO you can reference that in your template.
<?param:DLOGO?>
this needs to be at the top of the template. Then where you need to embed the image just reference the value using
$DLOGO
You can embed this in the external graphic field
As I mentioned I have not tested it yet, hopefully its there, if not there are ways around it. Try it first.
Tim -
File adapter - How to pass File name and path at runtime
Hi gurus,
We want to use PI 7.0 as an ftp server and expose the config as a webservice where the service consumer can pass one or more file names and the path to pick them and drop them on a fixed ftp server.
So precisely, I need to be able to set the file name, target directory parameters in both sender and receiver file/ftp adapters at runtime. is this possible at all ?
I am aware of passing Adapter specific parameters from sender file adapter to receiver file adapter to create the same folder structure and file names. But my requirement is different. I hope I am clear.
Could I please get some advise on this .
Thanks & Kind Regards,
Jhansi.Hi Jhansi,
Either you can go ahead with dynamic configuration as said by other SDN'ers. Else can go with Java Mapping:
Here is the code for Java Mapping:
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.text.*;
import java.util.*;
public class GetDynamicConfiguration implements StreamTransformation {
private Map param;
public void setParameter(Map map1) {
this.param = map1;
public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException {
try {
AbstractTrace trace = null;
// a) Set ouput File name
String directory=null;
trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
param.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
String filename =conf.get(key);
conf.put(key, filename);
trace.addInfo("File name is "+filename);
if(filename.equals("in.txt"))
directory = "/home/ftpxi/in";
if(filename.equals("test.txt"))
directory = "/home/ftpxi/in/test";
if(filename.equals("shweta27.txt"))
directory = "/home/ftpxi/in/test";
trace.addInfo("Directory name is "+directory);
conf.put(key1, directory);
// b) Just copy input file to output file
byte[] b = new bytehttp://inputstream.available();
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception) {
exception.printStackTrace(); -
How to dynamically create sqlldr control file using stored procedure
I am trying to dynamically create the control file (.ctl) and execute the same using a stored procedure.I would be passing the file name as a parameter to this procedure. How do I go about doing this?
The control file has the following structure. The file name (mktg) varies and is passed as an input to the stored procedure.
SPOOL mktg.ctl
LOAD DATA
INFILE 'mktg.csv'
INTO TABLE staging
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(COMPANY_NAME,
ADDRESS,
CITY,
STATE,
ZIP)
SPOOL OFF ;
sqlldr scott/tiger CONTROL= mktg.ctl LOG=mktg.log BAD=mktg.badWe are using oracle 9i rel 2.
I have not had much success with the creation of log and bad files using external tables when they are being used within a dynamic sql.
Plz check this:
Re: problems related to data loads from excel, CSV files into an oracle 9i db -
Passing file location as URL parameter for xml query
Hi all,
A quick question regarding using a parameter to set the source URL in an XML query template.
When assigning the URL, the static text works perfectly eg:
//<servername>/<folder>/samplefile.xml . The xml is returned as required.
However, we wish to call this from a BLS txn and set the source URL dynamically.
To test this we assigned //<servername>/<folder>/samplefile.xml to Parameter no 1 and insert [Param.1] in the source URL field. No luck.
Any suggestions?
Cheers
MarkMark,
In BLS, the double slashes (escaping the single /) are only necessary if you are building the full http url string in the link editor.
If your XMLQuery template is something like http://localhost/Folder/Subfolder/[Param.1] then put in a default param value in the query template and make sure the query test works. Then configure (or reconfigure) this in your BLS transaction and generate the sample results. All you should have to do in BLS then is to assign your Transaction or Local property to the Param.1 link in your XMLQuery action block. All of the dynamic replacement and subsequent xml file retrieval should then be done by the XMLQuery itself.
If you can keep the majority of the URL in the XMLQuery itself and then just dynamically pass it the Param.1 piece it will be very easy to test and configure (also use localhost if the file lives on the xMII web server), but if you have to build the string external in BLS I would recommend using a combination of the expression editor and a Local property. If the Local string property contains the base of http://localhost/Folder/Subfolder/ (no quotes or character escaping needed for the default value of a string property) then just assign something like the following to your Param.1 property of the XMLQuery: Local.URLBase & "filename.xml" (a simple evaluate will confirm your efforts).
Regards,
Jeremy -
Passing file name dynamically to sql loader ctl file
Hi,
I am new to scripting and I have a complex requirement involving writing a script.
Requierment:
I need to upload a CSV file from a FTP server into oracle table using SQL Loader. The file name resembles like APF0912312359.csv represents 31-DEC-2009 23:59 and there will be multiple files in same day indicated by differnt timestamp as its filename. Once I load a file using SQL loader, I need to move the file to another directory for archival.
Since the sql loader ctl file has a fixed file name, I would like to know how I can pass the file name dynamically to ctl file to load a new file every time it runs.
Any help is greatly appreciated..
Bye
Sudheer
Edited by: user2138419 on Oct 28, 2009 4:08 PMI agree with Pradeep in regards to declaring the file names on the command line. However, I do have a concern regarding presenting the password on the command line as any user that can issue a ps (assuming Unix ~= Linux here) would be able to read it while the sqlldr command is running.
Unfortunately, you may not always have the option of declaring the files on the command line. I was recently challenged with this in a Windows 2003 Server environment running SQL*Loader: Release 10.2.0.1.0. In this environment I found that I am able to set a variable file name in a calling batch file and use that value in the control file successfully. Just to demonstrate the approach:
Batch file:
set IN_FILE=’c:\inbound\load_me.txt’
sqlldr user/pswd@db PARFILE=’c:\parameters.txt’
Parameter file:
errors=500000
rows=50000
control=%CTL_FILE%
bad=%BAD_FILE%
discard=%DSC_FILE%
log=%LOG_FILE%
Control file:
LOAD DATA
INFILE ‘%IN_FILE%’
INSERT
INTO TABLE table_to_be_loaded
I’m really interested to see if this would work on Unix.
-Luke -
Cant pass file from a dir to fileinputstream()
hi !
i am stuck here ..please help.
I have an application that creates a dir called temp in home directory . and and a file which is named in following format. for example
080718002220.txt
i.e. systemdate.ext type . Since this files are created in real time and has no specific file name .How would i pass it to fileinputstream() .
Note : only one file will be there at a time but has no fixed file name as is mentioned in tutorials.
Is there a way to pass either the naming pattern or file extention to do select the file .??A hint: you can peruse a directory for its contents.
A sidenote: *.* denotes the working directory, which might be different from the home directory.
Maybe you are looking for
-
I have several keynote presentations that are missing their video clips. Does the original video clip need to stay on the camera roll after you embed it in the presentation? I thought not, because when you add a video, a message comes up saying "co
-
Accessing objects after closing the PersistenceManager
I have a session bean which returns a collection of objects obtained from a query. The problem is if I close my PersistenceManager in the session bean method, I can't access the objects. What will happen if I don't close it? Won't I have a memory lea
-
Upgraded Sawtooth 450Mhz AGP G4 video card to Radeon 9200
Just upgraded my video card to a Radeon 9200 Mac version yesterday, from the original Rage 128 card. The 21" CRT Apple Studio Display had finally gone "toes up" after 7 years and 9 months of 12 hours use each and every single day at my studio (minus
-
HP Laserjet 5200- Ethernet- Network host is busy - problem
Hi I just bought an HPLaserjet 5200 GN. I got it up and running and it prints its test page fine and the mac seems to see the printer when I check the system profiler but alas it wont print. I get the response: attempting to connect to host on port 9
-
How to read the value from other cubes ??
Dear All, I have requirement to do some calculation where part of number there must be got from other info-cube. e.g. Cube 1 Has: Ch1, Ch2, Kf1, Kf2, Kf3 Cube 2 Has: Ch3, Ch4, Kf4, Kf5 Then the requirement need to compute: KF1 = KF4 * KF3 Let say th