Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL LOADER with less fields in data file.

User_CS62GOct 21 2021

Hello,
I have a scenario to implement where in I have 10 columns in a table which has to be loaded in APPEND mode, i.e. the table already has records and we have to insert new records into it.
In data file we are only getting 8 columns data as the first 2 columns which are NOT NULL will contain constant values as 'CONS' & SYSDATE for every record to be inserted. Data file contains data from 3 column.
Now the requirement is to generate the control file dynamically and using the control file generated and data file load the data using sql loader.
For example :
Data file :
ABC,123,DEF,456,01/10/2021,GHI,100,09/30/2021

Record Inserted in table should be like :
image.pngPlease suggest how to generate the control file dynamically which will help in loading 'CONS' for 1st column & SYSDATE for 2nd column and rest of the columns should be loaded as per the data available in data file.

Thanks & Regards,
Biswajeet Ghosh

Comments

A RMI client talks to a RMI server.

Did you write the C++ program to be a RMI server or client? Since writing a C++ program as a RMI server would be a fairly difficult undertaking and one would really understand RMI when done with it, I would guess that your exe is not a RMI server.

What you could do is write a RMI server in java. Then every time your client called a method on your RMI object it would cause the server to run the C++ exe by using Runtime.exec(). The server would collect the result and return it.
843829
Hi,

I have write a RMI server in java and use it to run my C++ exe. Same as you said. But it still can't return anything to me. I have checked the return stream from this process. Nothing inside.

Any idea??

Thx. a lot

Francis
You would have to provide more information before I could possibly have any ideas. Such as what 'nothing inside' means.

I suggest you seperate out the RMI code from the exec code. Get one piece to work and then the other and then combine them back together.

And use lots of System.out.println().
843829
Dear,

I have used the function available( ) to check the stream. But it return 0. So I said it is nothing inside.

And would you mind give me some examples about this. As I am a newbie in JAVA programming.

Thx.

Francis
You used available() to check which stream?

Presumably you mean the output from the Runtime.exec()? How many times did you check it? Did you wait for the process to terminate?

Reduce the code to the exec() code only and then post it.
843829
Dear,

Here is my code to run the Runtime.exec()

Process tmp = Runtime.getRuntime().exec( cmd )
OutputStream a = Runtime.getOutputStream
int ok = a.available();

And I want to ask how to wait process terminate?

Thx. a lot

Francis
Waiting...

int exitResult = tmp.waitFor();
if (exitResult != 0) {* probably not good*/}
843829
have you tried using exitValue() ? it returns 0 if the subprocess termintated normally
843829
have you tried using exitValue() ? it returns 0 if the
subprocess termintated normally
i should add that 0 is the usual return value. your app could return another value for normal termintation
843829
Dear,

It has returned 0. But I still can't get back the value from C program.

Thx. a lot

Francis
If waitFor returned zero then that is the exit value of the application that is being run. If you expect another value I would suggest looking at how the application is run (for instance if it is being run in a script/batch file that has nothing to do with java.) Or that you reexamine why you think it should be returning something besides zero.

1 - 11

Post Details

Added on Oct 21 2021
3 comments
1,189 views