Using files in procedures
Hi all,
I have a senario where a procedure should pick the files
from say 4 folders, do some validations and load into a table. But the names of the files keep changing for each and every load. Can you help how to tackle this problem.
thanks and regards
Lijju Mathew
see if you can write the procedure with a parameter for the file name and use UTL_FILE routines to read files and load into staging tables for analysis.
Similar Messages
-
Display data in log file using PL/SQL procedure
Just as srw.message is used in Oracle RDF Reports to display data in log file in Oracle Apps, similarly how it is possible to display data in log file using PL/SQL procedure?
Please also mention the syntax too.Pl post details of OS, database and EBS versions.
You will need to invoke the seeded FND_LOG procedure - see previous discussions on this topic
Enable debug for pl/sql
https://forums.oracle.com/forums/search.jspa?threadID=&q=FND_LOG&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
HTH
Srini -
Problem using File sharing in a small office network
I have a problem using File sharing on an Imac and Macbook Pro.
My office has a small network running Windows Small office file server 2003. I have one Windows 2000 PC connected to it and 3 Macs, an 2.4 gHz Intel iMac running Leopard 10.5.6 , a MBP running the same and a Mac Mini running 10.5.
From the Finder Shared window of the Mac Mini, I can see all the computers on the network. It also used to be the case for the iMac, but the MBP could never see the Windows PC’s, not the server or the Win2000. This wasn’t a big problem as I was communicating between the Macs and using the shared printer on the iMac.
On Monday Jan 19 the iMac was suddenly unavailable to the other 2 Macs. It was working normally on the Friday. The iMac can access the Mac Mini and copy files to it. The Mac Mini can see the iMac but cannot access it. Even trying to connect as, ends in a failed connection. I have tried rebooting, turning File sharing off and then on again to no avail.
The iMac now also cannot see the Windows PC’s which it previously could.
To get files from the MBP for printing, I now copy it to the Mac Mini and acces the folder from the iMac, a very tedious procedure. I don’t know why this happened and am scared that the Mac Mini is going to do the same thing.
All three computers are also running VMware 2.0 with Windows XP pro, and from VMware the server is visible on all the computers.
Any help will be much appreciated, I live in a small town in South Africa and the local computer suppliers have no knowledge of the Macs.
I think that the problem with the iMac may have started after a software upgrade to 10.5.6 but I am not entirely sure.
Thank you
ajdkWell, you're current method sounds pretty good. But if you want to user a file server, hey go ahead.
What you want to do when you centralize project files is to keep track of which one is the newest and becareful not to overwrite files with the same name. So you either have to set up individual spaces on the server (separate AFP/FTP folders maybe), or you'll need to run a file checkout service.
The individual space is cheaper, but it's not much of a difference from backing up to the network drive. Since you have Gigabit connections, you might even opt to save ALL the user files on the server instead of just the project files.
If you want to run a file checkout service, there's two approaches. You can run a service that can host any kind of file, or you can run a version control system for each kind of application (Photoshop, Word, etc.). Please notice, that as you read further and further along, the methods become more and more expensive and complicated. Once you get to this point, it will be necessary to purchase or build software in addition to the Mac OS X Server package. -
ORA-04030: out of process memory when using Java Stored Procedures
Hello,
I have a problem using Java Stored Procedures in Oracle 10g.
My Java application performs http posts to a webservice and the response is parsed in order to populate some DB tables.
There is a scheduled job which calls the Java Stored Procedure every x minutes.
No matter of the 'x minutes' values - after about 160 - 200 calls I get this error:
ORA-04030: out of process memory when trying to allocate 1048620 bytes (joxp heap,f:OldSpace)
ORA-04030: out of process memory when trying to allocate 2097196 bytes (joxp heap,f:OldSpace)
The job stops just while is posting the http request. The weird thing is that almost each time the first http post request I get this error:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:140)
at org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory.createSocket(SSLProtocolSocketFactory.java:130)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
and the second try works fine.
So, The out of process memory occured each time just before getting such an error, and I suspect to be a connection between these errors.
Tech details:
1. OS: WinXP
2. Oracle 10.1.0.2.0
3. To perform http post I use HttpClient 3.1 from Apache.
4. I checked the http connection to be closed each time, and this is done.
5. I checked the oracle statement and connection to be closed each time and this is done
6. The JVM error (logged in .trc files of Oracle) is:
java.lang.OutOfMemoryError
at java.lang.Thread.start(Native Method)
at sun.security.provider.SeedGenerator$ThreadedSeedGenerator.run(SeedGenerator.java:297)
DB Settings details:
Starting up ORACLE RDBMS Version: 10.1.0.2.0.
System parameters with non-default values:
processes = 200
sessions = 225
shared_pool_size = 159383552
large_pool_size = 8388608
java_pool_size = 104857600
nls_language = AMERICAN
control_files = C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL01.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL02.CTL, C:\ORACLE\PRODUCT\10.1.0\ORADATA\XXXXXX\CONTROL03.CTL
db_block_size = 8192
db_cache_size = 29360128
compatible = 10.1.0
fal_client = XXXXXX
fal_server = XXXXXXs
log_buffer = 524288
log_checkpoint_interval = 100000
db_files = 70
db_file_multiblock_read_count= 32
db_recovery_file_dest = C:\oracle\product\10.1.0\flash_recovery_area
db_recovery_file_dest_size= 2147483648
standby_file_management = AUTO
undo_management = AUTO
undo_tablespace = undotbs_01
undo_retention = 14400
remote_login_passwordfile= EXCLUSIVE
db_domain =
dispatchers = (PROTOCOL=TCP) (SERVICE=XXXXXXXDB)
remote_dependencies_mode = SIGNATURE
job_queue_processes = 4
parallel_max_servers = 5
background_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\BDUMP
user_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\UDUMP
max_dump_file_size = 10240
core_dump_dest = C:\ORACLE\PRODUCT\10.1.0\ADMIN\XXXXXX\CDUMP
sort_area_size = 1048576
sort_area_retained_size = 1048576
db_name = XXXXXX
open_cursors = 500
optimizer_mode = FIRST_ROWS
pga_aggregate_target = 25165824
Any help would be appreciated. Thanks.
Can be a problem with JVM threading under Oracle ?The server prcess failed to allocate more memory for large objects ( in Oldspace).
If you Google ORA-04030, you will see several recommendations to work around this.
The Java VM in the database already has HttpClient, i don't know why you are loading the Apache HttpClient but this might not be the surce of the problem.
Kuassi http://db360.blogspot.com -
Need help with BC4J/Struts application using a Stored Procedure
Hi,
I am doing a proof of concept for a new project using JDeveloper, Struts and BC4J. We want to reuse our Business logic that is currently residing in Oracle Stored Procedures. I previously created a BC4J Entity Object based on a stored procedure Using Oracle Stored Procedures but this stored procedure is a bit different in that it returns a ref cursor as one of the paramters. http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
I tried the above method, but I am having some trouble with it. I keep getting the error ORA-01008: not all variables are bound when I test it using the AppModule tester.
Here is the store procedure definition:
CREATE OR REPLACE PACKAGE pprs_test_wrappers IS
TYPE sn_srch_results IS REF CURSOR;
PROCEDURE sn_srch_main_test
(serial_num_in IN OUT VARCHAR2
,serial_coll_cd_in IN OUT NUMBER
,max_rows_allowed IN OUT NUMBER
,total_rows_selected IN OUT NUMBER
,message_cd_out IN OUT VARCHAR2
,query_results OUT sn_srch_results
END pprs_test_wrappers;
And here is my code:
package pprs;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import oracle.jbo.JboException;
import oracle.jbo.domain.Number;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle Business Components for Java.
public class LienCheckImpl extends ViewObjectImpl
* This is the PLSQL block that we will execute to retrieve the REF CURSOR
private static final String SQL =
"begin ? := pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
public LienCheckImpl() {}
* Overridden framework method.
* Executed when the framework needs to issue the database query for
* the query collection based on this view object. One view object
* can produce many related result sets, each potentially the result
* of different bind variable values. If the rowset in query is involved
* in a framework-coordinated master/detail viewlink, then the params array
* will contain one or more framework-supplied bind parameters. If there
* are any user-supplied bind parameter values, they will PRECEED the
* framework-supplied bind variable values in the params array, and the
* number of user parameters will be indicated by the value of the
* numUserParams argument.
protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
* If there are where-clause params (for example due to a view link)
* they will be in the 'params' array.
* We assume that if some parameter is present, that it is a Deptno
* value to pass as an argument to the stored procedure.
* NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
* ---- but this parameter value should be oracle.jbo.domain.Number type.
String serialNumIn = null;
BigDecimal serialCollCdIn = null;
BigDecimal maxRowsAllowed = null;
BigDecimal totalRowsSelected = null;
String messageCdOut = null;
if (params != null) {
serialNumIn = (String)params[0];
serialCollCdIn = (BigDecimal)params[1];
maxRowsAllowed = (BigDecimal)params[2];
totalRowsSelected = (BigDecimal)params[3];
messageCdOut = (String)params[4];
storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
serialCollCdIn,
maxRowsAllowed,
totalRowsSelected,
messageCdOut));
super.executeQueryForCollection(qc, params, numUserParams);
* Overridden framework method.
* Wipe out all traces of a built-in query for this VO
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
* Overridden framework method.
* The role of this method is to "fetch", populate, and return a single row
* from the datasource by calling createNewRowForCollection() and populating
* its attributes using populateAttributeForRow().
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
* We ignore the JDBC ResultSet passed by the framework (null anyway) and
* use the resultset that we've stored in the query-collection-private
* user data storage
rs = getResultSet(qc);
* Create a new row to populate
ViewRowImpl r = createNewRowForCollection(qc);
try {
* Populate new row by attribute slot number for current row in Result Set
populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
populateAttributeForRow(r,2, rs.getString(3));
populateAttributeForRow(r,3, rs.getString(4));
populateAttributeForRow(r,4, rs.getString(5));
catch (SQLException s) {
throw new JboException(s);
return r;
* Overridden framework method.
* Return true if the datasource has at least one more record to fetch.
protected boolean hasNextForCollection(Object qc) {
ResultSet rs = getResultSet(qc);
boolean nextOne = false;
try {
nextOne = rs.next();
* When were at the end of the result set, mark the query collection
* as "FetchComplete".
if (!nextOne) {
setFetchCompleteForCollection(qc, true);
* Close the result set, we're done with it
rs.close();
catch (SQLException s) {
throw new JboException(s);
return nextOne;
* Overridden framework method.
* The framework gives us a chance to clean up any resources related
* to the datasource when a query collection is done being used.
protected void releaseUserDataForCollection(Object qc, Object rs) {
* Ignore the ResultSet passed in since we've created our own.
* Fetch the ResultSet from the User-Data context instead
ResultSet userDataRS = getResultSet(qc);
if (userDataRS != null) {
try {
userDataRS.close();
catch (SQLException s) {
/* Ignore */
super.releaseUserDataForCollection(qc, rs);
* Return a JDBC ResultSet representing the REF CURSOR return
* value from our stored package function.
private ResultSet retrieveRefCursor(Object qc,
String serialNum,
BigDecimal serialColCd,
BigDecimal maxRows,
BigDecimal totalRows,
String messageCd ) {
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Register the first bind parameter as our return value of type CURSOR
st.registerOutParameter(1,OracleTypes.CURSOR);
* Set the value of the 2nd bind variable to pass id as argument
if (serialNum == null) st.setNull(2,Types.CHAR);
else st.setString(2,serialNum);
if (serialColCd == null) st.setNull(3,Types.NUMERIC);
else st.setBigDecimal(3,serialColCd);
if (maxRows == null) st.setNull(4,Types.NUMERIC);
else st.setBigDecimal(4,maxRows);
if (totalRows == null) st.setNull(5,Types.NUMERIC);
else st.setBigDecimal(5,totalRows);
if (messageCd == null) st.setNull(6,Types.CHAR);
else st.setString(6,messageCd);
st.execute();
ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
* Make this result set use the fetch size from our View Object settings
rs.setFetchSize(getFetchSize());
return rs ;
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Store a new result set in the query-collection-private user-data context
private void storeNewResultSet(Object qc, ResultSet rs) {
ResultSet existingRs = getResultSet(qc);
// If this query collection is getting reused, close out any previous rowset
if (existingRs != null) {
try {existingRs.close();} catch (SQLException s) {}
setUserDataForCollection(qc,rs);
hasNextForCollection(qc); // Prime the pump with the first row.
* Retrieve the result set wrapper from the query-collection user-data
private ResultSet getResultSet(Object qc) {
return (ResultSet)getUserDataForCollection(qc);
* Return either null or a new oracle.jbo.domain.Number
private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
try {
return b != null ? new oracle.jbo.domain.Number(b) : null;
catch (SQLException s) { }
return null;
I created the view object in expert mode so there is no entity object. Can someone help? I don't have much time left to finish this.
Also, could I have done this from the Entity object instead of the view object by registering the ref cursor OUT parameter in handleStoredProcInsert()?
Thanks
NatalieI was able to get the input parameter by putting the following in my struts actions class
vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
The full code is:
package mypackage2;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jbo.html.BC4JContext;
import oracle.jbo.ViewObject;
import oracle.jbo.html.struts11.BC4JUtils;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class LienCheckView1QueryAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
BC4JContext context = BC4JContext.getContext(request);
// Retrieve the view object instance to work with by name
ViewObject vo = context.getApplicationModule().findViewObject("LienCheckView1");
vo.setRangeSize(3);
vo.setIterMode(ViewObject.ITER_MODE_LAST_PAGE_PARTIAL);
// Do any additional VO setup here (e.g. setting bind parameter values)
vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
// default value for serialCollCd 1 is for Motor Vehicles
vo.setWhereClauseParam(1,new oracle.jbo.domain.Number(1));
// Default value for maxRows_allowed
vo.setWhereClauseParam(2,new oracle.jbo.domain.Number(20));
return BC4JUtils.getForwardFromContext(context, mapping);
This doesn't always work properly though. The first time I press the query button, the SerialNum parameter is still null, however if I re-execute the query by pressing the query button again. It will work, and return the rows. I always have to query twice. Also the SerialNum attribute is set to a String in my view object, it is a varchar column in the database, but some serial number I enter give a "Error Message: oracle.jbo.domain.Number ". This happens even though the underlying BC4J is returning values for the query. I also get a "500 Internal Server Error java.lang.ClassCastException: java.lang.String on my View object's code at line 65 which is
if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
This is an input paramter to the oracle stored procedure that defaults to a Number value of 1.
Any idea what the problem is? Here is the full code for my view object:
package mypackage1;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import oracle.jbo.JboException;
import oracle.jbo.domain.Number;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle Business Components for Java.
public class LienCheckViewImpl extends ViewObjectImpl
* This is the PLSQL block that we will execute to retrieve the REF CURSOR
private static final String SQL =
"begin pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
private BigDecimal totalRows = null;
private String messageCd = null;
private BigDecimal serialColCd = null;
private BigDecimal maxRows = null;
public LienCheckViewImpl() {}
* Overridden framework method.
* Executed when the framework needs to issue the database query for
* the query collection based on this view object. One view object
* can produce many related result sets, each potentially the result
* of different bind variable values. If the rowset in query is involved
* in a framework-coordinated master/detail viewlink, then the params array
* will contain one or more framework-supplied bind parameters. If there
* are any user-supplied bind parameter values, they will *PRECEED* the
* framework-supplied bind variable values in the params array, and the
* number of user parameters will be indicated by the value of the
* numUserParams argument.
protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
* If there are where-clause params (for example due to a view link)
* they will be in the 'params' array.
* We assume that if some parameter is present, that it is a Deptno
* value to pass as an argument to the stored procedure.
* NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
* ---- but this parameter value should be oracle.jbo.domain.Number type.
String serialNumIn = null;
BigDecimal serialCollCdIn = null;
BigDecimal maxRowsAllowed = null;
BigDecimal totalRowsSelected = null;
String messageCdOut = null;
if (params != null) {
if (params.length>0) serialNumIn = (String)params[0];
if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
if (params.length>2) maxRowsAllowed = (BigDecimal)params[2];
storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
serialCollCdIn,
maxRowsAllowed));
super.executeQueryForCollection(qc, params, numUserParams);
* Overridden framework method.
* Wipe out all traces of a built-in query for this VO
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
* Overridden framework method.
* The role of this method is to "fetch", populate, and return a single row
* from the datasource by calling createNewRowForCollection() and populating
* its attributes using populateAttributeForRow().
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
* We ignore the JDBC ResultSet passed by the framework (null anyway) and
* use the resultset that we've stored in the query-collection-private
* user data storage
rs = getResultSet(qc);
* Create a new row to populate
ViewRowImpl r = createNewRowForCollection(qc);
try {
* Populate new row by attribute slot number for current row in Result Set
//AddedByRegisNum
populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
System.out.println("AddedByRegisNum :" + rs.getBigDecimal(1));
// OrigRegisNum
populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
System.out.println("OrigRegisNum :" + rs.getBigDecimal(2));
// SerialNum
populateAttributeForRow(r,2, rs.getString(3));
System.out.println("SerialNum :" + rs.getString(3));
// SerialNumDesc
populateAttributeForRow(r,3, rs.getString(4));
System.out.println("SerialNumDesc :" + rs.getString(4));
// FlagExactMatch
populateAttributeForRow(r,4, rs.getString(5));
System.out.println("FlagExactMatch :" + rs.getString(5));
// MessageCd
populateAttributeForRow(r,5, messageCd);
// TotalRows
populateAttributeForRow(r,6, totalRows);
catch (SQLException s) {
throw new JboException(s);
return r;
* Overridden framework method.
* Return true if the datasource has at least one more record to fetch.
protected boolean hasNextForCollection(Object qc) {
ResultSet rs = getResultSet(qc);
boolean nextOne = false;
try {
nextOne = rs.next();
* When were at the end of the result set, mark the query collection
* as "FetchComplete".
if (!nextOne) {
setFetchCompleteForCollection(qc, true);
* Close the result set, we're done with it
rs.close();
catch (SQLException s) {
throw new JboException(s);
return nextOne;
* Overridden framework method.
* The framework gives us a chance to clean up any resources related
* to the datasource when a query collection is done being used.
protected void releaseUserDataForCollection(Object qc, Object rs) {
* Ignore the ResultSet passed in since we've created our own.
* Fetch the ResultSet from the User-Data context instead
ResultSet userDataRS = getResultSet(qc);
if (userDataRS != null) {
try {
userDataRS.close();
catch (SQLException s) {
/* Ignore */
super.releaseUserDataForCollection(qc, rs);
* Overridden framework method
* Return the number of rows that would be returned by executing
* the query implied by the datasource. This gives the developer a
* chance to perform a fast count of the rows that would be retrieved
* if all rows were fetched from the database. In the default implementation
* the framework will perform a SELECT COUNT(*) FROM (...) wrapper query
* to let the database return the count. This count might only be an estimate
* depending on how resource-intensive it would be to actually count the rows.
public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
Object[] params = viewRowSet.getParameters(true);
String serialNumIn = (String)params[0];
BigDecimal serialCollCdIn = (BigDecimal)params[1];
BigDecimal maxRowsAllowed = (BigDecimal)params[2];
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Register the fourth bind parameter as our return value of type NUMERIC
st.registerOutParameter(4,Types.NUMERIC);
* Set the value of the 3 bind variables to pass as arguments
if (serialNumIn == null) st.setNull(1, Types.CHAR);
else st.setString(1,serialNumIn);
if (serialCollCdIn == null) st.setNull(2,Types.NUMERIC);
else st.setBigDecimal(2,serialCollCdIn);
if (maxRowsAllowed == null) st.setNull(3, Types.NUMERIC);
else st.setBigDecimal(3, maxRowsAllowed);
st.execute();
System.out.println("returning value of :" + st.getLong(4));
return st.getLong(4);
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Return a JDBC ResultSet representing the REF CURSOR return
* value from our stored package function.
private ResultSet retrieveRefCursor(Object qc,
String serialNum,
BigDecimal serialColCd,
BigDecimal maxRows) {
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Set the value of the bind variables
System.out.println("SerialNumIn :" + serialNum);
if (serialNum == null) st.setNull(1,Types.CHAR);
else st.setString(1,serialNum);
if (serialColCd == null) st.setNull(2,Types.NUMERIC);
else st.setBigDecimal(2,serialColCd);
if (maxRows == null) st.setNull(3,Types.NUMERIC);
else st.setBigDecimal(3,maxRows);
st.registerOutParameter(1, Types.CHAR); // serialNum
st.registerOutParameter(2, Types.NUMERIC); // serialColCd
st.registerOutParameter(3, Types.NUMERIC); // maxRows
st.registerOutParameter(4, Types.NUMERIC); // totalRows
st.registerOutParameter(5, Types.CHAR); // messageCd
* Register the 6th bind parameter as our return value of type CURSOR
st.registerOutParameter(6,OracleTypes.CURSOR);
st.execute();
ResultSet rs = ((OracleCallableStatement)st).getCursor(6);
serialColCd = st.getBigDecimal(2);
System.out.println("SerialColCd= " + serialColCd);
maxRows = st.getBigDecimal(3);
System.out.println("maxRows= " + maxRows);
totalRows = st.getBigDecimal(4);
System.out.println("totalRows= " + totalRows);
messageCd = st.getString(5);
System.out.println("messageCd= " + messageCd);
* Make this result set use the fetch size from our View Object settings
rs.setFetchSize(getFetchSize());
return rs ;
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Store a new result set in the query-collection-private user-data context
private void storeNewResultSet(Object qc, ResultSet rs) {
ResultSet existingRs = getResultSet(qc);
// If this query collection is getting reused, close out any previous rowset
if (existingRs != null) {
try {existingRs.close();} catch (SQLException s) {}
setUserDataForCollection(qc,rs);
hasNextForCollection(qc); // Prime the pump with the first row.
* Retrieve the result set wrapper from the query-collection user-data
private ResultSet getResultSet(Object qc) {
return (ResultSet)getUserDataForCollection(qc);
* Return either null or a new oracle.jbo.domain.Number
private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
try {
return b != null ? new oracle.jbo.domain.Number(b) : null;
catch (SQLException s) { }
return null;
Natalie -
Looking for some help with using Oracle stored procedures in vb2010
First off thank you to whoever lends me a hand with my problem. A little background first I am in a software development class and we are currently building our program using VB (I have no experience in this), and Oracle(currently in a Oracle class so I know how to use Oracle itself just not with VB).
I am using vb2010 express edition if that helps. Currently I have a stored procedure that takes a 4char "ID" that returns a position (ie, salesperson,manager ect). I want to use the position returned to determine what vb form is displayed (this is acting as a login as you dont want a salesperson accessing the accountants page for payroll ect).
Here is the code I have currently on the login page of my VB form
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class Login
Dim conn As New OracleConnection
Private Sub empID_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles empID.Click
End Sub
Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
conn.ConnectionString = "User ID = Auto" & _
";Password = ********" & _
";Data Source = XE"
conn.Open()
Dim sq1 As String = "Return_Position" 'name of procedure
Dim cmd As New OracleCommand(sq1, conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter("I_EmpID", OracleDbType.Char, 4)).Value = Emp_ID.Text
Dim dataReader As OracleDataReader = cmd.ExecuteReader
dataReader.Read()
Dim position As New ListBox
position.Items.Add(dataReader.GetString(0)) 'were I am getting an error, I also tried using the dataReader.getstring(0) to store its value in a string but its a no go
If position.FindStringExact("MANAGER") = "MANAGER" Then
Me.Hide()
Dim CallMenu As New Menu()
CallMenu.ShowDialog()
End If
LoginBtn.Enabled = False
End Sub
I have read the oracle.net developer guide for using oracle in vb2010 and have successfully gotten through the document however they never use a stored procedure, since the teacher wants this program to user a layered architecture I cannot directly store sql queries like the document does, thus the reason I want to use stored procedures.
This is getting frustrating getting stuck with this having no background in VB, I could easily do this in c++ using file i/o even through it would be a pain in the rear....Hello,
I am calling Oracle 11g stored procedures from VB.Net 2010. Here is a code sample (based on your code) you should be able to successfully implement in your application.
Please note that you may have to modify your stored procedure to include an OUT parameter (the employee position) if it doesn't have it yet.
Private Sub LoginBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoginBtn.Click
Dim sProcedureName As String = "Return_Position" 'name of stored procedure
Dim ORConn as OracleConnection, sConn as String
Dim sPosition as String, sDataSource as String, sSchema as String, sPWD as String
Dim cmd As OracleCommand
'please provide below sDataSource, sSchema and sPWD in order to connect to your Oracle DB
sConn = "Data Source=" & sDataSource & ";User Id=" & sSchema & ";Password=" & sPWD & ";"
ORConn = New OracleConnection(sConn)
ORConn.Open()
cmd = New OracleCommand(sProcedureName, ORConn)
With cmd
.CommandType = Data.CommandType.StoredProcedure
'input parameter in your stored procedure is EmpId
.Parameters.Add("EmpID", OracleDbType.Varchar2).Value = Emp_ID.Text
.Parameters.Item("EmpID").Direction = ParameterDirection.Input
'output parameter in your stored procedure is Emp_Position
.Parameters.Add("Emp_Position", OracleDbType.Varchar2).Direction = ParameterDirection.Output
.Parameters.Item("Emp_Position").Size = 50 'max number of characters for employee position
Try
.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
Exit sub
End Try
End With
sPosition = cmd.Parameters.Item("Emp_Position").Value.ToString
'close Oracle command
If Not Cmd Is Nothing Then Cmd.Dispose()
Cmd = Nothing
'close Oracle connection
If Not ORConn Is Nothing Then
If not ORConn.State = 0 Then
ORConn.Close()
End If
ORConn.Dispose()
End If
ORConn = Nothing
If UCase(sPosition) = "MANAGER" Then
Me.Hide()
Dim CallMenu As New Menu()
CallMenu.ShowDialog()
End If
LoginBtn.Enabled = False
End Sub
If you need further assistance with the code, please let me know.
Regards,
M. R. -
Using File Browse to update stored file
Hi all,
I have a form with a File Browse item on it which is (surprisingly!) used to upload a file and associate with a record. The filename is stored in a varchar column in the table. This works fine when I create (INSERT) the initial record and I can retrieve the stored file just fine. However the problem I have is when I want to update the uploaded file. It seems the normal mechanisms for update / save requests don't apply to uploaded files. My other attributes get updated fine but the new uploaded filename is not reflected in the table.
I've put together a simple example of this on a when apex.oracle.com :
http://apex.oracle.com/pls/otn/f?p=40740
Which has two fields, a file name and an 'attribute'. Try as I might I can't update the file name although the attribute changes just fine.
Any suggestions will be much appreciated. I realise I may be missing something fundamental here and am more than happy to be enlightened.
FYI, the purpose for such functionality is to allow users of our system to store a photograph of themselves along with their details. This functionality is required to allow the photograph to be updated if required.
Thanks,
SteveIf i am not mistaking, using a file browser item type will not set the uploaded file (blob) in this item, to be processed in the standard processing on you're page.
In a recent project i wrote a stored procedure for handling with uploaded files. This procedure, which based on the filename ( Fnnnn/<filename> ) , select the uploaded content through apex_application_files, the location apex saves the files. and procedure outputted the file as a blob, which then can be used to insert/update in youre table
Hope this example code will help you:
procedure upload_bestand( p_file_name in varchar2
, p_file out nocopy blob
, p_filetype out nocopy varchar2 )
is
-- Cursor voor bepalen bestand uit apex_application+files
cursor c_file ( b_file_name in varchar2)
is
select aaf.filename
, aaf.mime_type
, aaf.blob_content
from apex_application_files aaf
where aaf.name = b_file_name
r_file c_file%rowtype;
begin
open c_file ( b_file_name => p_file_name );
fetch c_file into r_file;
if c_file%notfound
then
-- Upload van bestand niet geslaagd
close c_file;
raise e_file_err;
end if;
close c_file;
-- Geupload bestand uit temp_upload tabel verwijdern
delete from apex_application_files
where name = p_file_name
commit;
p_file := r_file.blob_content;
p_filetype := r_file.mime_type;
end upload_bestand; -
How to store image in the oracle database 10.2. using File Maker 10.
Hi.,
I want to store image, media file in the oracle database using File Maker as a front end.
I connect Oracle using odbc from file maker. There are table and in that table there a column "pict" of blob type. but this column is not showing in the file maker.
2. Here I can not change the data type of any column.
Now how to store images in the oracle table using odbc or any other tool.
Regards,
ShyamI wrote an example for my students, you can find it here. It's using PHP as the front end but all you need to do is know how and leverage the stored procedures. All code is downloadable in zip files from the blog.
http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/ -
Sending an excel sheet of to mail Ids using file to mail scenario
Hello,
I have a folder with three folders archive exception and log. Log folders have the details of exception. I want the XML files that are in Exception, to be sent to resp email ids with the data in it to be stored in an excel sheet( data will be collected from the log file for the correspondng file in exception).
eg: if test.xml is in exception its log will have an exception detail somethng like " Enter a value".
In this case i want to give the exception details as well as some relevant details with it like material number etc , time at which the exception occured . These details are to be given in an excel sheet .
Is it possible to do using file to mail scenario. Please help by explianing the procedure.
Regards.This can be done with the help of some Java and ABAP coding. I can give you a general view on how to do this.
1. Configure a file adapter for sender to pick up the exception files.
2. While doing the mapping, create a UDF to store the values (which you need to send it to excel file) in a table in ABAP Stack.
3. Create a ABAP Program in R3 (which can be schedule on regular intervals depending on ur req) to create an excel sheet based on the the data in the table (created in previous step). I am not sure how easy to code ABAP program to create an excel sheet.
4. Create one more file adapter to send this excel sheet to the corresponding mail ids.
This is a very high level view on doing this. -
Can we use FILE IO in File Adapter ? If not, Why?
Hello,
I want to clarrify one important issue of FIle Adapter.
Can we use FILE I/O in case of File Adapter to process the files.
PLease explain me with a reason and a sample example.
Thanks,
Soorya.I think you can handle File IO in Java Mapping by using
public void execute(InputStream in, OutputStream out)
// Here You can desired the output from source XML structure by using SAX/DOM parser to Target XML file. -
Unable to delete files from encrypted external SD Card using File Commander
I've run into some trouble trying to delete the directory com.spotify.music from my external SD Card (encrypted) after a hard reboot using the reset button next to the sim card.
I need to do this for the Spotify app to work (FC on starting it) and I'm currently unable to delete the folder and its contents from Sony provided file explorer(FC File Commander).
Is there a way to delete this app from adb or other command line tool or how should I go about this? Developer options are enabled because I'm learning to develop apps. Not particularly keen on rooting or otherwise format my SD Card but it's an option if there are no other ways to do it.
I can see the contents of my card using File Commander just fine. Spotify app is uninstalled, I tried remove cache and data before uninstall also.Thommo wrote:
Are you able to delete files via your Pc or are you able to remove the card from your phone and connect it to a Pc for file deletion - There is a free program called Unlocker currently on version 1.9.2 which is excellent at deleting files that don't want to be deleted - You would install the program then right click the file and choose Unlocker and then when the program starts choose delete
I guess he will not be able to move the SD card to the computer since it's encrypted and is working only with that particular device, but he should be able to access it via PC.
If you can try to uninstall Spotify from your phone. I assume Spotify is not working due to some rubbish inside it's directory, but on the other hand you can't delete the folder because it may be used by Spotify. If you uninstall app folder may be unlocked.
Best regards,
Sergio PL
Xperia Z1 / Nexus 7 (2012) -
Office 2004 crashes in Leopard when using File print option.
Office 2004 apps all crash when I try to print using File>print but they will print if I just use the printer icon. Any ideas?? I have updated Office to 11.3.9 and uninstalled and reinstalled the printer. BTW, the printer is an HP Laserjet All-in-one model 3330. Everything else I've tried seems to print ok -- Safari, Adobe, Pages.
I would like to upgrade three other machines but I'm waiting until I get this print problem resolved.
Thanks.Well I feel sort of stupid, I was using the HP driver. Switching to either of the drivers supplied with Leopard fixed this problem. Thanks.
-
How to add header line in a file from XI system using file adapters
Hi All,
I need to add header line (Column names) in a file coming from XI system.
I am using file adapters.
Thanks & Regards,
Gaurav MittalThe Receiver File Adapter is configured, using the following settings:
1) Choose File Content Conversion as the Message Protocol.
2) You give the addHeaderLine parameter as 1
3) For the fieldSeparator parameter you need to give field separator for both list and substructure (referring to the data type above). For eg: it may be a , (comma) for substructure in a comma separated file.
4) The endSeparator parameter needs to given for substructure only. For eg: it may be a nl (new line)
5) Give the file name, the directory and the Construction mode. Activate all the settings. Receiver File Adapter with F.C.C. is configured.
please visit the blog.
/people/arpit.seth/blog/2005/06/02/file-receiver-with-content-conversion
/people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1
/people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2 -
I loaded iTunes on a new laptop. I copied and pasted my albums to a 4G stick and down loaded them to the new laptop. Placing them in, Libraries – Music – iTunes and than in Itunes used File – add file to library. So far so good. For what ever reason one of the CDs would not load onto the stick. I got the orginal CD and loaded directly to Itunes. Now when I look in Libraries – Music – iTunes it’s not there but it is in and plays in iTunes. What should I have done or should I be doing? Thanks.
It's not a unique situation - happens all the time, smaller hard drives getting filled up.
It's also easy to fix. I just moved my itunes content to a bigger hard drive.
First I made a backup of the itunes database file - iTunes Library.itl. Just in case anything went wrong.
Nothing did go wrong, but I'd have it in case anything DID go wrong. That file holds ratings, playcounts, Date Added, and other metadata.
Second, in itunes change the preferences > advanced tab to tell itunes to put everything on G:
Set the itunes folder location to something like G:Media or G:iTunes
This will affect all FUTURE additions to itunes and not do anything to the existing locations.
Make sure the checkbox for "Keep itunes organized" is NOT checked. I also left the "Copy files when adding" unchecked.
Third, to move all the files to G: without itunes losing the paths, run the File > Library > Organize > Consolidate command. This will need to run a while, so be patient as it copies all the files to the new G: location. This does NOT delete the originals. You will have to do that.
Fourth, make sure everything in itunes is OK and you can play stuff in your library. If you're really cautious you can run a script to check for missing/dead tracks. -
How to use File History from same account on 2 PCs to same NAS
I recently upgraded from Win7 to Win8.1 and am unsuccessful in using File History as I'd like. Perhaps it's a configuration issue, so I'll explain my goal, what I've done, and the problem:
I have a PC and laptop, both in the same HomeGroup and I use the Microsoft Account on both. Heretofore I've used a 'backup program' (SyncBack Pro), to synch the Documents folder between the PC and laptop, and then backup the PC's Documents folder to
a folder on a NAS (Network Attached Storage). That worked file.
Now, attempting to use File History, I setup up a NAS:\File History folder on the NAS and turned File History on both on the PC and laptop, pointing to the same NAS:\File History folder on the NAS. (Actually, I didn't enable it on the laptop until
File History on the PC had completed its initial run.) Within 1 or 2 days, the NAS was out of space but shouldn't have been. When I use Windows Explorer to list contents of subfolders in Documents in the File History folder on the NAS, it shows
the same files and sizes as it shows on the folders on the PC. But when I use Windows Explorer to get the Properties of those folders, it shows exactly 2 or 3 (differs by folder) times as many files, and 2 or 3 times the total space taken on the
PC. There are many folders in the $OF folder. I assumed (perhaps wrongly) that $OF would hold old files (e.g., deleted or superseded) but there probably aren't more than 4-5 files that changed over this time period. All this is making
me think that perhaps when File History runs on, say the laptop, it actually replaces all files of the same names saved by File History running on the PC and vice versa. Perhaps that's wrong, but it's the only way I can explain the explosion of the number
of files and space consumed by even multiples (2 or 3, at which point the NAS ran out of space).
So, given my goal -- making sure there is a shared backup of all Documents files on the NAS -- is there a way I can set up File History on both the PC and laptop so the same file is represented once in the NAS:\File History ?????
Finally, in case it's relevant, when I set up File History on the PC it asked me if I wanted to invite others in the HomeGroup to do so, but nothing resembling an 'invitation' ever appeared on the laptop.
Many thanks to anyone who can address this.Hello RASSRQ,
Do you mean that the file history in NAS need 2 or 3 times space as the file on PC?
Please explain a bit about the sentence ‘When I use Windows Explorer to list contents of subfolders in Documents in the File History folder on the NAS, it shows the same files and sizes as it shows on the folders on the PC. But when I use Windows Explorer
to get the Properties of those folders, it shows exactly 2 or 3 (differs by folder) times as many files, and 2 or 3 times the total space taken on the PC. There are many folders in the $OF folder. ’
I can’t understand: What is $OF folder? Could you please share us a screenshot about $OF folder if you willing to?
What folders in $OF folder?
Based on my test, I follow the steps by referring to the following article and can’t find the similar issue.
http://windows.microsoft.com/en-HK/windows-8/set-drive-file-history
Best regards,
Fangzhou CHEN
Fangzhou CHEN
TechNet Community Support
Maybe you are looking for
-
any help with this would be appreciated
-
APEX 3.0.1 /Vista Premium install failing:
Hi Can anyone assist me with this ... I get following error when running chart_demo app. fm."Release 3.0 New Feature Demos" page under APEX 3.0.1 and Vista Premium: "A script in this movie is causing Macromedia Flash Player 7 to run slowly. If it con
-
[SOLVED] Sony Vaio Keys don't work (probably udev issue)
Hardware: SONY VAIO VPC-EH2L1R Linux distribution: archlinux, XFCE udev versions: 177, 178 (core), udev-git 20120123-1 (AUR) keyboard driver: evdev At least a week earlier I had some of Sony Vaio Keys working: Volume control (Fn+F2: mute, Fn+F3: down
-
Single text and date/time line still stays?
i think ios 8 update did this with IOS 7 you were able to delete a single text message within a message string and the date and time stamp of the message string was reset back to the last message in the string. In IOS 8 even if you delete a single te
-
MY IPOD LOCKED, HOW I CAN OPEN WITH ITUNES
please any body tell me how i can open my Ipod again