Synonym issue in Oracle 11g
Hi All,
I came across strange issue on basic nature of Synonyms in Oracle 11gR2. Below is the scenario
I have two users U1 and U2, in the same database.
Schema Objects of U1 and U2 are on different tablespace, not on SYSTEM. I can refer and access any valid U1 object in U2 as U1.object_name or with synonym. But whenever I refer, I get error "OCI-21700: object does not exist or is marked for delete".
I have tested this with both private and public synonyms in U2. I have granted ALL access from U1 on the objects.
Please help me on this.
SBH
Hi SBH,
Can you execute the below and try again. I think you are getting the error while executing a PL/SQL block. Correct me if I'm wrong.
GRANT SELECT ANY DICTIONARY TO U2;Have you granted access via roles or direct ?
Cheers
Kanchana.
Edited by: Kanchana Devasurendra on Oct 6, 2010 10:58 AM
Similar Messages
-
Export and Import issue in Oracle 11g
Hi All,
I have exported data using exp command in oracle 11g by keeping deferred_segment_creation FALSE.
Even then my zero records tables are not coming in export.
What could be the reason or what other thing i have to do to make it work.
Thanks in advance
Mohsin JTables that were created before you changed deferred_segment_creation to FALSE and do not have any rows would still be segment-less tables --- i.e. not exported.
You need to issue an "ALTER TABLE tablename MOVE" for each of such tables (after having set deferred_segment_creation to FALSE) to force a rebuild of these tables with segments before the export.
Thus, the sequence is
1. set deferred_segment_creation to FALSE
2. identify all tables with 0 rows
3. issue an ALTER TABLE tablename MOVE for each of such tables from step 2
4. Re-run your export
alternatively use conventional export (exp) instead of datapump export.
Hemant K Chitale -
Environment Issue in Oracle 11g.
I have a java stored procedure loaded into Oracle 11g that reads a CLOB type, and getting a null pointer exception in one oracle 11g environment and not in another. Following is the code snippet,
<code>StringBuffer str = new StringBuffer(); String strng; BufferedReader bufferRead = new BufferedReader(clb.getCharacterStream()); while ((strng=bufferRead .readLine())!=null) str.append(strng); </code>
I believe it has nothing todo with the code, because same code is not giving any error and working fine in the other. Following is the version of oracle 11g in both the environments
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for Linux: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production
can you please guide where else can i find the root cause of this issue. Is there a way to find the loaded java class versions on the database?I'd suggest running it from SQLPlus, where all your System.out.println statements will show up and you won't need to bother the DBA for that output ... unless you have already done so or if you happen to be the DBA. From the snippet you provided the only thing that looks like it could be null is "clb".
-
Listner issues in Oracle 11g server installation
Hi,
I am facing problem while connecting to Oracle 11g server on 'Windows 7 Enterprise edition - 32 bit OS'.
I have successfully installed Oracle 11g server on Windows & enterprise machine.
Listener and TNSnames.ora files are fine. But I am not able to connect through Oracle client machine. it shows 'TNS: Could not resolve the service name'.
When I check the listener status on the server, it shows the service ABBPROD is READY, but still not able to connect through client machine. I have gone through many similar threads and tried out the solutions provided but the problem still exists. Few of the things I tried are as below.
1. I have tried changing the ORACLE_SID and setting the $ORACLE_HOME parameter.
2. Tried replacing the HOST as 'localhost' to system IP address/computer name
3. Listener stop and start
4. Service stop and start
5. Checked the firewall settings of the server machine
I shall paste the listener.ora and tnsnames.ora files below.
LISTENET.ORA
# listener.ora Network Configuration File: C:\app\INSAJEN\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\INSAJEN\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\INSAJEN\product\11.2.0\dbhome_1\bin\oraclr11.dll")
(SID_DESC =
(SID_NAME = ABBPROD)
(ORACLE_HOME = C:\app\INSAJEN\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\INSAJEN\product\11.2.0\dbhome_1\bin\oraclr11.dll")
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ADR_BASE_LISTENER = C:\app\INSAJEN
TNSNAMES.ora file
# tnsnames.ora Network Configuration File: C:\app\INSAJEN\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
ABBPROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.140.233.130)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = abbprod)
LISTENER_ABBPROD =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
SQLNET.ORA
# sqlnet.ora Network Configuration File: C:\app\INSAJEN\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)Please help me to debug and resolve the problem. If any more information is required, please let me knowSBH wrote:
I checked the global_name, it is ABBPROD.asiapacific.abb.com...
I tried setting the ORACLE_SID same as this name, but still the same issue exists
@Mahir, this is a production environment, and I cannot take risk of rebuilding tnsnames and listener.ora filesand
I am facing problem while connecting to Oracle 11g server on 'Windows 7 Enterprise edition - 32 bit OS'.
I have successfully installed Oracle 11g server on Windows & enterprise machine.Your production sever running on Windows 7 EE 32bit? -
DB connection issue for Oracle 11g with jdk1.3
Hi Experts,
I have jdk1.3 installed. I need to connect to Oracle 11g, but there is no driver class for Oracle 11g with jdk1.3. I have Classes12.jar for Oracle 9i with jdk1.3. When I try to connect to Oracle 11g with jdk1.3 using Classes12.jar, I get the below error
Error:
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=185599744)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:335)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:334)....
Please help to solve this issue. This is urgent.
Thanks."connection refused" is quite a clear error message;
- either you configure a wrong host name or port number
- the database isn't even running
- a firewall is blocking you
In any case no connection can be made to the database, which is hardly a programming or driver problem. You'll have to figure out for whatever external reason you cannot create a connection to the database. Good luck. -
Post installation issues in Oracle 11g
Hi,
i have installed oracle 11g on my windows vista- ultimate OS. installation was successful without any error, but after the completion of installation i found that sqlplus.exe file's icon was not proper. it is like a default .exe icon of vista. moreover this, when i executed it, i am getting a command prompt window instead of regular SQL window that we get in any previous versions of oracle. Though everything is working fine.
So, could anyone please tell me what's wrong? Why i am getting such an interface?With 11g, the SLQPlusW is no longer available. SQLPlus in command prompt is what we have left. However you now have SQLDeveloper automatically included.
-
Database timeout issue in oracle 11g 64 bit windows machine
Hi ,
Database connection getting timedout for every 30 seconds in oracle 11g database 64 bit windows environment.
And the error we are getting is "Invalid user name and passoword".
After altering the schema passoword
alter username identified by pwd;
we are able to connect to database but it is getting timedout after 30 seconds.
Is there any parameter settings that requires changes or verifications.
We are facing this using sqlplus as well as through JDBC connection.
Thanks
PrasannaCheck profile assigned to user... there is a parameter idle_time.. increase this..
-
Issue in Oracle 11g Database Change Notification for Java application
Hi,
I am trying to use Oracle's Database Change Notification in Java application.
I followed the sample application (+DBChangeNotification.java+ , Example 29-2), provided in the following link:
+[http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/dbmgmnt.htm#CHDEJECF]+
I am able to see that the Registration of the SQL query is successful.
But, when I do changes to the table registered, notifications are not received in the Listener class (+DCNDemoListener.java+).
Ideally, the method DCNDemoListener.onDatabaseChangeNotification() should be invoked on any insert/update to the registered table. But this method is not getting invoked.
The execution has stopped in the following line of DBChangeNotification.java Class.
this.wait();
+==> The application was WAITing indefinitely in this line, as the NOTIFY() from DCNDemoListener.java was not executed.+
I am using VPN to connect to Oracel server. Remote Oracle Server is protected my firewall. Is this the reason for not sending the notifications from Oracle server?
The version of software used are given below:
Oracle Client - Oracle 11.1.0
JDK - 1.6
Oracle JDBC Driver - ojdbc6.jar
Can someone help me to resolve this issue?
Thanks in Advance.
Regards
Sam
Edited by: Ponsu on Apr 7, 2011 10:41 PMHi,
I am having similar issue. Where you able to resolve it.
I am also using the same example you were using.
I am using the following version.
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
Compatibility: 11.2.0.0.0
I do not see any notification coming back from the DB.
Appreciate your help.
Thanks & regards,
Ebe -
Issue: Combining oracle 11g with richfaces
Hi All,
I'm using Oracle JDeveloper 11G release (11.1.1.7.0) with JSF1.2. I need to implement ajax functionality in the application. I am trying to add richfaces-3.3.2.SR1 to the app.
Tried multiple combinations of filters in the web.xml, also tried to manipulation of the renderer-kits.
Please find below the stacktrace:
java.lang.NullPointerException at oracle.adfinternal.view.faces.renderkit.rich.RichRenderUtils.isEmailablePage(RichRenderUtils.java:755) at oracle.adfinternal.view.faces.config.rich.URLEncodingConfigurator$RestrictedResourceURLEncoder.encodeResourceURL(URLEncodingConfigurator.java:83) at org.apache.myfaces.trinidadinternal.config.URLEncoderExternalContext.encodeResourceURL(URLEncoderExternalContext.java:26) at org.apache.myfaces.trinidad.context.ExternalContextDecorator.encodeResourceURL(ExternalContextDecorator.java:122) at org.apache.myfaces.trinidad.context.ExternalContextDecorator.encodeResourceURL(ExternalContextDecorator.java:122) at org.apache.myfaces.trinidad.context.ExternalContextDecorator.encodeResourceURL(ExternalContextDecorator.java:122) at org.apache.myfaces.trinidad.context.ExternalContextDecorator.encodeResourceURL(ExternalContextDecorator.java:122) at org.ajax4jsf.resource.ResourceBuilderImpl.getUri(ResourceBuilderImpl.java:326) at org.ajax4jsf.resource.InternetResourceBase.getUri(InternetResourceBase.java:218) at org.ajax4jsf.resource.BaseResourceRenderer.encodeBegin(BaseResourceRenderer.java:64) at org.ajax4jsf.resource.OneTimeRenderer.encodeBegin(OneTimeRenderer.java:48) at org.ajax4jsf.resource.BaseResourceRenderer.encode(BaseResourceRenderer.java:47) at org.ajax4jsf.resource.InternetResourceBase.encode(InternetResourceBase.java:313) at org.ajax4jsf.context.ViewResources.encodeSkinningResources(ViewResources.java:294) at org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:510) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:193) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:979) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:408) at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:237) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271) at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177) at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at com.ejada.railways.filters.CustomCharacterEncodingFilter.doFilter(CustomCharacterEncodingFilter.java:29) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119) at java.security.AccessController.doPrivileged(Native Method) at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324) at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460) at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103) at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171) at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
My application is a "Generic application". Any help/pointer to resolve this is highly appreciated.
ThanksHi,
What kind of ajax functionality do you intend to use. ADF has AJAX support in built for its components ? . My guess is here the filters and implementation of JSF spec are interfering with each other.
Regards,
Ramandeep -
ALBPM 5.7 BPM process admin issues with Oracle 11g RAC as directory service
Hi,
Setup ALBPM 5.7 enterprise for weblogic.
BPM Engine deployed on weblogic cluster.
BPM process admin (web console) deployed on tomcat.
BPM process admin uses WEB-INF/directory.properties for directory configuration.
things were fine with oracle SID,
directory.default.url=oracle://<db_host>:1521/schema=diruser,sid=BPMDB { with this, login to process admin was working fine}
But clueless, on how to configure RAC as the directory service in the above directory.properties file. Since this is a old version, no directory.xml in the installation.
Connection string:
(DESCRIPTION =
(LOAD_BALANCE = on)
(FAILOVER = on)
(ADDRESS = (PROTOCOL = TCP)(HOST = DB_HOST1)(PORT=1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = DB_HOST2)(PORT=1521))
(CONNECT_DATA =
(SERVICE_NAME = BPMDB)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
Please help how to use service name (above connection string) in directory.properties, to be able to login to process admin successfully.
Thanks in advance,
SwamyUsing admin center, able to get the string to be used in directory.properties.
FYI, the string looks like below,
directory.default.url=oracle://customURL:0/schema=bpmdirectory,customURL=jdbc:oracle:thin:@(DESCRIPTION = (LOAD_BALANCE = on)(FAILOVER = on)(ADDRESS = (PROTOCOL = TCP)(HOST = DB_HOST1)(PORT=1521))(ADDRESS = (PROTOCOL = TCP)(HOST = DB_HOST2)(PORT=1521)) (CONNECT_DATA = (SERVICE_NAME = BPMDB.DOMAIN.COM) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC)))) -
UTL FILE OUTPUT FILE FORMAT ISSUE ON ORACLE 11G
how to format util file output align with column value with proper format.
set serveroutput on
DECLARE
CURSOR h1
IS
select 'TOTAL_ACCOUNT_REJECTS' as TOTAL_ACCOUNT_REJECTS ,
'PC' as PC ,
'RT' as RT,
'SERIAL' as SERIAL
from dual;
-- l_app_nm := RTRIM( TRIM( l_line ), CHR(13) );
CURSOR c1
IS
SELECT
company ,
user,
app,
account
FROM account_auth
WHERE ROWNUM < = 5;
lc_file_handle UTL_FILE.file_type;
lc_file_dir VARCHAR2 (100);
lc_file_name VARCHAR2 (50);
gov_005_payment_rec VARCHAR2 (1000);
BEGIN
lc_file_dir := 'OUTB';
lc_file_name := 'test.txt';
lc_file_handle := UTL_FILE.fopen (lc_file_dir, lc_file_name, 'W',1024);
FOR i IN h1
LOOP
gov_005_payment_rec :=
i.TOTAL_ACCOUNT_REJECTS
||' '
|| i.PC
|| ' '
|| i.RT
|| ' '
|| i.SERIAL;
UTL_FILE.put_line (lc_file_handle, gov_005_payment_rec);
END LOOP;
FOR i IN c1
LOOP
gov_005_payment_rec :=
i.company
||' '
|| i.user
||' '
|| i.app
||' '
|| i.account;
UTL_FILE.put_line (lc_file_handle, gov_005_payment_rec);
END LOOP;
EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN DBMS_OUTPUT.PUT_LINE('Invalid
path!');
WHEN UTL_FILE.INVALID_MODE THEN DBMS_OUTPUT.PUT_LINE('Invalid
mode!');
WHEN UTL_FILE.INVALID_OPERATION THEN DBMS_OUTPUT.PUT_LINE('Invalid
operation!');
WHEN OTHERS
RAISE;
END ;
OUTPUT : issue with file format
TOTAL_ACCOUNT_REJECTS PC RT SERIAL
&&&&&846 000000000000 APPLICATION123 20570
&&&&284 000000000000 APPLICATION133 20570
&&&2&&846 000000000000 APPLICATION163 20570
EXPECTED output ==> please advise me , how to create proper formatted output file using utl_file? thanks in advance.
TOTAL_ACCOUNT_REJECTS PC RT SERIAL
&&&&&846 000000000000 APPLICATION123 20570
&&&&284 000000000000 APPLICATION133 20570
&&&2&&846 000000000000 APPLICATION163 20570Example of creating a fixed width format file for a dynamically provided query, using the DBMS_SQL package...
As SYS user:
CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
As myuser:
CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
,p_dir IN VARCHAR2
,p_header_file IN VARCHAR2
,p_data_file IN VARCHAR2 := NULL) IS
v_finaltxt VARCHAR2(4000);
v_v_val VARCHAR2(4000);
v_n_val NUMBER;
v_d_val DATE;
v_ret NUMBER;
c NUMBER;
d NUMBER;
col_cnt INTEGER;
f BOOLEAN;
rec_tab DBMS_SQL.DESC_TAB;
col_num NUMBER;
v_fh UTL_FILE.FILE_TYPE;
v_samefile BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
BEGIN
c := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
d := DBMS_SQL.EXECUTE(c);
DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
ELSE
DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
END CASE;
END LOOP;
-- This part outputs the HEADER
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 2 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),rec_tab(j).col_max_len,' ');
WHEN 12 THEN v_finaltxt := v_finaltxt||rpad(lower(rec_tab(j).col_name),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
IF NOT v_samefile THEN
UTL_FILE.FCLOSE(v_fh);
END IF;
-- This part outputs the DATA
IF NOT v_samefile THEN
v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
END IF;
LOOP
v_ret := DBMS_SQL.FETCH_ROWS(c);
EXIT WHEN v_ret = 0;
v_finaltxt := NULL;
FOR j in 1..col_cnt
LOOP
CASE rec_tab(j).col_type
WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
v_finaltxt := v_finaltxt||rpad(nvl(v_v_val,' '),rec_tab(j).col_max_len,' ');
WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_n_val,'fm99999999999999999999999999999999999999'),' '),rec_tab(j).col_max_len,' ');
WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
v_finaltxt := v_finaltxt||rpad(nvl(to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),' '),greatest(19,length(rec_tab(j).col_name)),' ');
END CASE;
END LOOP;
UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
END LOOP;
UTL_FILE.FCLOSE(v_fh);
DBMS_SQL.CLOSE_CURSOR(c);
END;
This allows for the header row and the data to be written to seperate files if required.
e.g.
SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
PL/SQL procedure successfully completed.
Output.csv file contains:
empno ename job mgr hiredate sal comm deptno
7369 SMITH CLERK 7902 17/12/1980 00:00:00800 20
7499 ALLEN SALESMAN 7698 20/02/1981 00:00:001600 300 30
7521 WARD SALESMAN 7698 22/02/1981 00:00:001250 500 30
7566 JONES MANAGER 7839 02/04/1981 00:00:002975 20
7654 MARTIN SALESMAN 7698 28/09/1981 00:00:001250 1400 30
7698 BLAKE MANAGER 7839 01/05/1981 00:00:002850 30
7782 CLARK MANAGER 7839 09/06/1981 00:00:002450 10
7788 SCOTT ANALYST 7566 19/04/1987 00:00:003000 20
7839 KING PRESIDENT 17/11/1981 00:00:005000 10
7844 TURNER SALESMAN 7698 08/09/1981 00:00:001500 0 30
7876 ADAMS CLERK 7788 23/05/1987 00:00:001100 20
7900 JAMES CLERK 7698 03/12/1981 00:00:00950 30
7902 FORD ANALYST 7566 03/12/1981 00:00:003000 20
7934 MILLER CLERK 7782 23/01/1982 00:00:001300 10
The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
Adapt to output different datatypes and styles are required (this is currently coded for VARCHAR2, NUMBER and DATE) -
Update Global Temp Table in Oracle 11g
Hi Experts,
Scenario: I have stored procedure A which calls procedure B. Procedure B uses Global temp Tables(With On Commit Preserve Rows) to work with the data.
I am trying to update one of the GTT in Proc B but unable to do it .. via SQL or via PL/SQL Cursor/Collection. There is no syntax nor logical error and the PL/SQL proc completes execution successfully but the rows are not getting updated. My Db version is Oralce 11g 11203.
Update statement is something like this.
Update <GTT>
SET amount1 = amount1 *-1, amount2 = amount2 *-1
where field1 = <value>
and field2 in ( Select filed2 from <table1> );
Any idea why would this update not work? Has anyone faced this issue in Oracle 11g??
Appreciate your suggestions & thanks in Advance for your inputs.
Cheers,
MSUpdate statement is something like this.
Update <GTT>
SET amount1 = amount1 *-1, amount2 = amount2 *-1
where field1 = <value>
and field2 in ( Select filed2 from <table1> );
Any idea why would this update not work?
You already told us that it DOES work - no errors or exceptions.
It is trivial to determine if that update will do anything - just turn it into a SELECT and see if any rows are ntselected:
v_cnt INTEGER;
SELECT COUNT(*) INTO v_cnt FROM myGTT
WHERE field1 = <value>
AND field2 in (Select field2 from <tablee1>);
Then take a look at the 'count' that you get. -
How to remove the background grayed color in oracle 11g (graph) reports
Hello,
We have an issue with oracle 11g reports. we migrated the reports from 10g to 11g version. for graphical oriented reports by default it displaying grayed backgound color. but i want to change it to set as white background please help me on this.
Edited by: user4661358 on Sep 12, 2010 11:00 PMThere is an excellent support note with several known issues in 11g related to graphs.
Reference
Known Issues Using Graph in FMW 11g (Doc ID 1328155.1)
Regards, RZ -
IPlanet 6.0 SP6 compatibility with Oracle 11g Client in Windows server 2003
Hi All,
We have issues with our classic ASP application when connecting to Oracle 11g. Our application Database is migrating from oracle 10g to oracle 11g, with oracle 10g we don't have any issues but we are facing issues with Oracle 11g database
We are running iPlanet-WebServer-Enterprise/6.0SP6. And Chilisoft is Sun ONE ASP 4.0 (formerly known as Chili!Soft ASP) on windows 2003 machine for running ASP application.
The connection we are trying is
Provider=OraOLEDB.Oracle; Data Source=xxxx;User Id=xxx;Password=xxx;
The error we are getting is "OraOLEDB error '80004005' "
Question: Is iPlanet-WebServer-Enterprise/6.0SP6. And Chilisoft is Sun ONE ASP 4.0 is compatible with Oracle Client 11g in Windows 32 bit machine
Appreciate your quick response
Thanks,
MurthyI have the same situation. Could you please share your experience if you resolve it? Thanks.
-
Hi All,
I've faced one issue with Oracle 11g.
In Oracle 10g when you do:
create table Test as
select Cast(SomeField as nvarchar2(1)) as SomeField from Other_table;
if SomeField type is number(5) and it has value 11 - following error message will be generated:
ORA-12899: value too large for column ???
(actual: 3, maximum: 1)
and that is fair. In Oracle 11g the same operation inserts truncated values i.e. 1 in this example.
Is there a way to make it wok in 11g in the same way as 10g except compatibility parameter changes?
Thank you in advance.I don't have access to 10g - just 9.2.0.8 vs 11.2.0.2.
See the following output:
SQL> select * from v$version;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
PL/SQL Release 9.2.0.8.0 - Production
CORE 9.2.0.8.0 Production
TNS for Solaris: Version 9.2.0.8.0 - Production
NLSRTL Version 9.2.0.8.0 - Production
SQL>
SQL> select cast('11' as nvarchar2(1)) col1 from dual;
C
1
SQL>
SQL> select cast(11 as nvarchar2(1)) col1 from dual;
select cast(11 as nvarchar2(1)) col1 from dual
ERROR at line 1:
ORA-25137: Data value out of range
SQL>
SQL> create table dom1
2 (col1 number(5)
3 ,col2 varchar2(5));
Table created.
SQL>
SQL> insert into dom1 values (11,'11');
1 row created.
SQL>
SQL> select cast(col1 as nvarchar2(1)) from dom1;
select cast(col1 as nvarchar2(1)) from dom1
ERROR at line 1:
ORA-25137: Data value out of range
SQL>
SQL> select cast(col2 as nvarchar2(1)) from dom1;
select cast(col2 as nvarchar2(1)) from dom1
ERROR at line 1:
ORA-01401: inserted value too large for column
SQL>
SQL> create table dom2 as
2 select Cast(col1 as nvarchar2(1)) as col1 from dom1;
select Cast(col1 as nvarchar2(1)) as col1 from dom1
ERROR at line 2:
ORA-25137: Data value out of range
SQL>
SQL> create table dom2 as
2 select Cast(col2 as nvarchar2(1)) as col2 from dom1;
select Cast(col2 as nvarchar2(1)) as col2 from dom1
ERROR at line 2:
ORA-01401: inserted value too large for column
SQL> vs
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL>
SQL> select cast('11' as nvarchar2(1)) col1 from dual;
C
1
SQL>
SQL> select cast(11 as nvarchar2(1)) col1 from dual;
select cast(11 as nvarchar2(1)) col1 from dual
ERROR at line 1:
ORA-25137: Data value out of range
SQL>
SQL> create table dom1
2 (col1 number(5)
3 ,col2 varchar2(5));
Table created.
SQL>
SQL> insert into dom1 values (11,'11');
1 row created.
SQL>
SQL> select cast(col1 as nvarchar2(1)) from dom1;
select cast(col1 as nvarchar2(1)) from dom1
ERROR at line 1:
ORA-25137: Data value out of range
SQL>
SQL> select cast(col2 as nvarchar2(1)) from dom1;
select cast(col2 as nvarchar2(1)) from dom1
ERROR at line 1:
ORA-01401: inserted value too large for column
SQL>
SQL> create table dom2 as
2 select Cast(col1 as nvarchar2(1)) as col1 from dom1;
select Cast(col1 as nvarchar2(1)) as col1 from dom1
ERROR at line 2:
ORA-25137: Data value out of range
SQL>
SQL> create table dom2 as
2 select Cast(col2 as nvarchar2(1)) as col2 from dom1;
select Cast(col2 as nvarchar2(1)) as col2 from dom1
ERROR at line 2:
ORA-01401: inserted value too large for column
SQL>
Maybe you are looking for
-
Im now usin ipod touch, i dunt know why the old voice memo cannot be synced from ipod touch to itunes??? I hv trimmed the old voice memo by 2 seconds, bt it stills doesnt work, can anyone teach me how to take the memo out???? THZ
-
Hi Experts, Is there any report in batch management to get a detailed listing of inventory(finished goods) by batch with all characteristic values info included? Best Regards CS
-
I WANT TO REMOVE BABYLON SEARCH WHICH APPEARS WHENEVER I START FIREFOX
In addition to above I wish to inform you that Babylon addon is not available in my computer so that I may remove the same. I suspect some scam as I want Google as my default web browser & I want that whenever I start Firefox I should see startup pag
-
This happened when I upgraded to the new iTunes.
-
Error when trying to run script using SDK at plugin startup
Hi I am trying to run a script when my InDesign plugin is loaded. I referred to the PanelTreeView sdk sample as an example and implemented a StartupShutdown Boss In my implementation, in the startup() method I have the code to get the scriptManager a