Query on Strings in point of memory..?
Can any one explain the below code clearly in point of memory?
String A = new String("abc"); // 1. How many objects are created here?
String B = "def"; //2. How many objects here?
A = A + B; // Here Value of A is 'abcdef'.
As we know String objects are immutable. The value of A is visible here 'abcdef' why cannt only 'abc'. Here reference of A was changed but how can we prove here the value of A is same at any time..? Plz explain clearly.
String A = new String("abc"); // 1. How manyobjects
are created here?One.
I heard that in above statement two objects are
created. this is one in String Constant Pool and
anothe is in Heap memory. Is it right?
If not wht is the use of String Constant Pool? If it
is right why String Objects are create in Heap as
well as String Constant Pool?I think it's correct that "abc" is placed in contant pool, and that new String creates yet another object.
You can verify that a string is immutable by executing the following code.
String a = "abc";
String tmp = a;
String a = a.concat("def");
System.out.println(a);
System.out.println(tmp);Kaj
Similar Messages
-
How to Copy a value of a String to the RAM memory?
Hi there,
I was wondering how to copy a String into the ram memory (consider you're doing right click on THIS word and choose 'Copy'; the String's Value will be to the ram memory for a later Paste).
In my application, a user has a table and he right click on it and choose Copy. I get the value of the item (Obj) but face dificulties to add it to RAM.
my code looks like this:
if (obj!=null) //inside I have the value (say: 12345 --< Obj.toString)
Action copyAction = TransferHandler.getCopyAction();
int id = ActionEvent.ACTION_PERFORMED;
String name = (String) copyAction.getValue(Action.NAME);
long l = EventQueue.getMostRecentEventTime();
copyAction.actionPerformed(new ActionEvent(XXXXXXX, id, name, l ,0));
///what comes in the XXXXXXX
}I tried, instead of the XXXXXXX, to put Obj or Obj.toString but...nothing.
Anyone?Thanks,
should implement ClipboardOwner
and do this:
StringSelection stringSelection = new StringSelection( obj.toString() );
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents( stringSelection, this );
@Override
public void lostOwnership(Clipboard clipboard, Transferable contents)
//do nothing!
} -
QBE Error when query by String for Number column
Hi,
I have a table with Number column.
The column structure is like below:
<af:column>
<af:inputText>
<f:validator .../>
<af:converNumber ..../>
</af:inputtext>
</af:column>
QBE is enabled for this column.
It works fine when query by Number value, such as '123'. But when I query by string like 'asd', it will return an error.
Anyone met this problem?Hi Arun,
I am using Jdev 11.1.1.7.0.
In my case,
I have a application table, from where user can create new row inline. Some fields in the row have type Long or Number. We are also using <af:converNumber ..../> inside <af:inputText> to do format.
I do have a query panel above the table. But we want the user can also filter the records using QBE. Other columns are working fine, except the columns with type 'Number' or 'Long'.
I checked the incident log, below are some useful information:
Caused by: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number
Caused by: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT ... FROM ... WHERE ... AND ( ( (MeaRulesEO.DEFAULT_MEA_PERIOD = :vc_temp_1 ) ) )
It seems 'MeaRulesEO.DEFAULT_MEA_PERIOD = :vc_temp_1' causes the error. Jdev assumes every input from QBE header as number. If String is entered, Jdev will return error.
I also checked that if the table is read-only, this problem does not exist.
Please help on this. Thank you. -
MaxDB cannot start: Missing root pointer in memory mapping
Hello,
I cannot start (or change to any other state) my MaxDB. I have already tried to remove directory rtedump_dir as per SAP Note 1283278, but this did not help.
Any help will be greatly appreciated
Warm greetings
Jan
mibse2:se2adm 62> dbmcli -d SE2 -u superdba,xxxyyy show state
OK
Missing root pointer in memory mapping when restoring memory map from /sapdb/SE2/data/wrk/SE2/rtedump_dir
mibse2:se2adm 63> dbmcli -d SE2 -u superdba,xxxyyy db_enum
OK
SE2 /sapdb/SE2/db 7.8.01.14 fast offline
SE2 /sapdb/SE2/db 7.8.01.14 quick offline
SE2 /sapdb/SE2/db 7.8.01.14 slow offline
SE2 /sapdb/SE2/db 7.8.01.14 test offline
mibse2:se2adm 64> dbmcli -d SE2 -u superdba,xxxyyy inst_enum
OK
7.8.01.14 /sapdb/clients/SE2
7.8.01.14 /sapdb/SE2/db
mibse2:se2adm 65> sdbregview -l
Installation: Global /sapdb/programs
Global Listener 7.8.01.14 valid 64 bit
Installation Compatibility 7.8.01.14 valid 64 bit
Installer 7.8.01.14 valid
SAP Utilities Compatibility 7.8.01.14 valid 64 bit
Installation: CL_SE2 /sapdb/clients/SE2
Base 7.8.01.14 valid 64 bit
Fastload API 7.8.01.14 valid 64 bit
JDBC 7.6.06.07 valid
Messages MSG 0.9004 valid
ODBC 7.8.01.14 valid 64 bit
SAP Utilities 7.8.01.14 valid 64 bit
SQLDBC 7.8.01.14 valid 64 bit
SQLDBC 76 7.6.06.10 valid 64 bit
SQLDBC 77 7.8.01.14 valid 64 bit
Installation: SE2 /sapdb/SE2/db
Base 7.8.01.14 valid 64 bit
DB Analyzer 7.8.01.14 valid 64 bit
Database Kernel 7.8.01.14 valid 64 bit
Fastload API 7.8.01.14 valid 64 bit
JDBC 7.6.06.07 valid
Loader 7.8.01.14 valid 64 bit
Messages MSG 0.9004 valid
ODBC 7.8.01.14 valid 64 bit
Redist Python 7.8.01.14 valid 64 bit
SAP Utilities 7.8.01.14 valid 64 bit
SQLDBC 7.8.01.14 valid 64 bit
SQLDBC 76 7.6.06.10 valid 64 bit
SQLDBC 77 7.8.01.14 valid 64 bit
Server Utilities 7.8.01.14 valid 64 bit
mibse2:se2adm 66> xinstinfo SE2
IndepData : /sapdb/data
IndepPrograms : /sapdb/programs
InstallationPath : /sapdb/SE2/db
Kernelversion : KERNEL 7.8.01 BUILD 014-121-233-288
Rundirectory : /sapdb/SE2/data/wrk/SE2
mibse2:se2adm 67>Hi,
1. Please update with output of the following commands:
ps u2013efe | grep dbmsrv
ls u2013l /var/lib/sdb/dbm/ipc
ipcs -m | wc u2013l
sysctl -a | grep kernel.shmmni
dbmcli inst_enum
dbmcli db_enum u2013s
2. Please post the dbmsrv*.err located in /sapdb/data/wrk
3. Check first<!> that you have not active dbmrfc/dbmsrv processes,
Stop the x_server .
- kill all these processes manually, if they where not release after
Closing DBMGUI, dbmcli sessions, stoping the application server.
- try to check/remove the shared memory
/sapdb/MAXDB1/db/pgm/dbmshm CHECK /var/lib/sdb/dbm/ipc MAXDB1
/sapdb/MAXDB1/db/pgm/dbmshm DELETE /var/lib/sdb/dbm/ipc MAXDB1
- Check in /var/lib/sdb/dbm/ipc if you have files MAXDB1.dbm.shi and MAXDB1.dbm.shm
< rename both files to MAXDB1.dbm.shi.old and MAXDB1.dbm.shm.old>
- Try to connect to the database using dbmcli tool & post results.
Hope above steps are helpful.
Regards,
Deepak Kori -
Fetch LONG column into String -- null pointer
Case 1/ Fetch a LONG column directly from embedded SELECT statement
Result: iterator.my_long_column() returns the expected data
Case 2/ Fetch the same LONG column from a REF CURSOR that was returned by a stored function
Result: For the first row fetched, iterator.my_long_column() now returns a null pointer, but all the other columns in the query (VARCHAR2s) still return the expected data. For subsequent rows everything works fine...
Any ideas?Hi
I faced similar error mistake was same as you did that giving it to string value ,
<MethodName> obj=new <MethodName>(modelobject);
List L1=new ArrayList();
ArrayOfString arrStr=new ArrayOfString(<modelobject>);
String_Item it=new String_Item(<modelobject>);
item.setItem(<Value1>); L1.add(it);
it=new String_Item(<modelobject>);
item.setItem(<Value2>); L1.add(it);
etc..
arrStr.set<setter>(L1);
obj.set<ArrayOfString(arrStr);
So it require a object of type Collection (List ...)
Hope it help you
Best Regards
Satish Kumar -
How to retrieve a SQL query (in String format) from a PreparedStatement
Hello all,
I am in the process of unit testing an application accessing a Oracle 9i 9.2 RDBMS server with JDBC.
My query is:
As I have access to PreparedStatement and CallableStatement Java objets but not to the source queries which help create those objects?
Is thtere a simple way by using an API, to retrieve the SQL command (with possible ? as placeholders for parameters).
I have already looked at the API documentation for those two objets (and for the Statement and ResultSetmetaData objects too) but to no avail.
Thank you for any help on this issue,
Best regards,
BenoîtSorry for having wasted your time... and for not understanding what you meant in your first reply.
But the codlet was only to show the main idea:
Here is the code which compiles OK for this approach to reach its intended goal:
main class (file TestSuiteClass.java):
import java.sql.*;
import static java.lang.Class.*;
* Created by IntelliJ IDEA.
* User: bgilon
* Date: 15/03/12
* Time: 10:05
* To change this template use File | Settings | File Templates.
public class TestSuiteClass {
public static void main(final String[] args) throws Exception {
// Class.forName("oracle.jdbc.OracleDriver");
final Connection mconn= new mConnection(
DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@host:port:service"));
* final Statement lstmt= TestedClass.TestedMethod(mconn, ...);
* final String SqlSrc= mconn.getSqlSrc(lstmt).toUpperCase(), SqlTypedReq= mconn.getTypReq(lstmt);
* assertEquals("test 1", "UPDATE IZ_PD SET FIELD1= ? WHERE FIELDPK= ?", SqlSrc);
Proxy class (file mConnector.java):
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
* Created by IntelliJ IDEA.
* User: bgilon
* Date: 15/03/12
* Time: 10:05
* To change this template use File | Settings | File Templates.
* This file should be compiled with JDK 1.6, but can be used with previous JDK versions.
* See OKwith1pN booleans usage for not throwing Exceptions as Unknown methods by the conn object...
public final class mConnection implements Connection {
private final Connection conn;
private final List<Statement> Stmts= new ArrayList<Statement>();
private final List<String> SqlSrcs= new ArrayList<String>();
private final List<Integer> TypSrcs= new ArrayList<Integer>();
private final static String jvmv= System.getProperty("java.specification.version");
private static final boolean OKwith1p2;
private static final boolean OKwith1p4; /* OKwith1p5, */
private static final boolean OKwith1p6;
static {
/* jvmv= System.getProperty("java.version");
System.out.println("jvmv = " + jvmv);
jvmv= System.getProperty("java.vm.version");
System.out.println("jvmv = " + jvmv); */
System.out.println("jvmv = " + jvmv);
OKwith1p2= (jvmv.compareTo("1.2") >= 0);
OKwith1p4= (jvmv.compareTo("1.4") >= 0);
// OKwith1p5= (jvmv.compareTo("1.5") >= 0);
OKwith1p6= (jvmv.compareTo("1.6") >= 0);
public String getSqlSrc(final Statement pstmt) {
int ix= 0;
for(Statement stmt : this.Stmts) {
if(stmt == pstmt) return SqlSrcs.get(ix);
ix+= 1;
return null;
static private final String[] TypeNames= new String[] { "Statement", "PreparedStatement", "CallableStatement" };
public String getTypReq(final Statement pstmt) {
int ix= 0;
for(Statement stmt : this.Stmts) {
if(stmt == pstmt) return TypeNames[TypSrcs.get(ix)];
ix+= 1;
return null;
private void storedStatement(
final Statement stmt,
final String sqlSrc,
final Integer typReq
Stmts.add(stmt);
SqlSrcs.add(sqlSrc);
TypSrcs.add(typReq);
public Connection getDecoratedConn() {
return conn;
mConnection(final Connection pconn) {
this.conn= pconn;
public boolean isClosed() throws SQLException {
return conn.isClosed();
public void rollback(Savepoint savepoint) throws SQLException {
if(OKwith1p4) conn.rollback(savepoint);
public boolean isReadOnly() throws SQLException {
return conn.isReadOnly();
public int getTransactionIsolation() throws SQLException {
return conn.getTransactionIsolation();
public void setTransactionIsolation(int level)throws SQLException {
conn.setTransactionIsolation(level);
public Properties getClientInfo() throws SQLException {
return OKwith1p6 ? conn.getClientInfo() : null;
public <T> T unwrap(Class<T> iface)
throws SQLException {
return conn.unwrap(iface);
public void setAutoCommit(boolean auto) throws SQLException {
conn.setAutoCommit(auto);
public boolean getAutoCommit() throws SQLException {
return conn.getAutoCommit();
public Map<String,Class<?>> getTypeMap() throws SQLException {
if(!OKwith1p2) return null;
return conn.getTypeMap();
public void setTypeMap(Map<String,Class<?>> map) throws SQLException {
if(!OKwith1p2) return;
conn.setTypeMap(map);
public void setHoldability(final int holdability) throws SQLException {
if(OKwith1p4) conn.setHoldability(holdability);
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
return conn.createStruct(typeName, attributes);
public void commit() throws SQLException {
conn.commit();
public void rollback() throws SQLException {
conn.rollback();
public boolean isValid(int timeout) throws SQLException {
return OKwith1p6 && conn.isValid(timeout);
public void clearWarnings() throws SQLException {
conn.clearWarnings();
public int getHoldability() throws SQLException {
if(!OKwith1p4) return -1;
return conn.getHoldability();
public Statement createStatement() throws SQLException {
return conn.createStatement();
public PreparedStatement prepareStatement(final String SqlSrc) throws SQLException {
if(!OKwith1p2) return null;
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
if(!OKwith1p4) return null;
final PreparedStatement lstmt= conn.prepareStatement(sql, columnNames);
storedStatement(lstmt, sql, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
storedStatement(lstmt, sql, 1);
return lstmt;
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(sql, columnIndexes);
storedStatement(lstmt, sql, 1);
return lstmt;
public void setClientInfo(String name, String value) throws SQLClientInfoException {
if(OKwith1p6)
conn.setClientInfo(name, value);
public PreparedStatement prepareStatement(final String SqlSrc,
int resultType,
int resultSetCurrency,
int resultSetHoldability) throws SQLException {
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, resultType, resultSetCurrency);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public PreparedStatement prepareStatement(final String SqlSrc,
int autogeneratedkeys) throws SQLException {
if(!OKwith1p4) return null;
final PreparedStatement lstmt= conn.prepareStatement(SqlSrc, autogeneratedkeys);
storedStatement(lstmt, SqlSrc, 1);
return lstmt;
public CallableStatement prepareCall(final String SqlSrc) throws SQLException {
final CallableStatement lstmt= conn.prepareCall(SqlSrc);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public CallableStatement prepareCall(final String SqlSrc,
int resultType,
int resultSetCurrency,
int resultSetHoldability) throws SQLException {
if(!OKwith1p4) return null;
final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency, resultSetHoldability);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
return OKwith1p6 ? conn.createArrayOf(typeName, elements) : null;
public CallableStatement prepareCall(final String SqlSrc,
int resultType,
int resultSetCurrency) throws SQLException {
if (!OKwith1p2) return null;
final CallableStatement lstmt= conn.prepareCall(SqlSrc, resultType, resultSetCurrency);
storedStatement(lstmt, SqlSrc, 2);
return lstmt;
public SQLXML createSQLXML() throws SQLException {
return OKwith1p6 ? conn.createSQLXML() : null;
public DatabaseMetaData getMetaData() throws SQLException {
return conn.getMetaData();
public String getCatalog() throws SQLException {
return conn.getCatalog();
public void setCatalog(final String str) throws SQLException {
conn.setCatalog(str);
public void setReadOnly(final boolean readonly) throws SQLException {
conn.setReadOnly(readonly);
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
return conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
if(!OKwith1p2) return null;
return conn.createStatement(resultSetType, resultSetConcurrency);
public String nativeSQL(final String sql) throws SQLException {
return conn.nativeSQL(sql);
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
if(OKwith1p4) conn.releaseSavepoint(savepoint);
public Savepoint setSavepoint() throws SQLException {
return OKwith1p4 ? conn.setSavepoint() : null;
public Savepoint setSavepoint(final String str) throws SQLException {
return OKwith1p4 ? conn.setSavepoint(str) : null;
public boolean isWrapperFor(Class iface) throws SQLException {
return conn.isWrapperFor(iface);
public String getClientInfo(final String str) throws SQLException {
return OKwith1p6 ? conn.getClientInfo(str) : null;
public void setClientInfo(final Properties pro) throws SQLClientInfoException {
if (OKwith1p6) conn.setClientInfo(pro);
public Blob createBlob() throws SQLException {
return OKwith1p6 ? conn.createBlob() : null;
public Clob createClob() throws SQLException {
return OKwith1p6 ? conn.createClob() : null;
public NClob createNClob() throws SQLException {
return OKwith1p6 ? conn.createNClob() : null;
public SQLWarning getWarnings() throws SQLException {
return conn.getWarnings();
public void close() throws SQLException {
conn.close();
Final word:
The final word about this is: there is currently three ways to obtain source SQL queries from compiled statement objects.
a) Use a proxy class the mConnector above;
b) Use a proxy JDBC driver as Log4JDBC;
c) Use the trace facility of the driver (however, post analyzing the logs would depend upon the driver selected).
Thank you for reading,
Benoît -
Converting int to string, adding to string then pointing to an url
So I'm getting a null pointer exception here's a snippet of my code (theres plus signs on both sides of the a in my code):
private Image[] tiles;
public Map() {
for(int a=0; a<9; a++){
ImageIcon aa = new ImageIcon(this.getClass().getResource("mapsquares"+a+".png"));
tiles[a] = aa.getImage();
I've also tried:
private Image[] tiles;
public Map() {
for(int a=0; a<9; a++){
ImageIcon aa = new ImageIcon(this.getClass().getResource("mapsquares$s.png", String.valueOf(a)));
tiles[a] = aa.getImage();
whats wrong with either of these?
Edited by: Wub on Feb 28, 2013 3:17 PM1.) You should use code tags when posting code.
2.) You should read the stacktrace closely to find out which exact line number in your code threw the exception.
My guess is that it's the line tiles[a] = aa.getImage(); because you didn't initialize the array tiles using the new operator. This is just a guess since you didn't post the full stacktrace. Also, NullpointerExceptions are one of the easiest to debug. Just adding print out lines at strategic values can show you which variables are initialized and which ones are not. -
Two string references pointing to the same object
Look at the following code snippet String s1 = "hello";
String s2 = "world";
String s3 = "welcome";
String s4 = "here";
String s5 = "hello";
They say that references s1 and s5 point to the same object "hello".
At run time after creating objects from s1 to s4 how the Java run time knows that there is already an object "hello" and assigns a differernt reference.When the jvm load the class file, all suchconstants
found in the class are loaded in a global constant
pool. when you assign the constant to a variable,it
uses the same one from the constant pool.Suppose I intialize a string by getiing input
nput from the console which already exists, in that
case a new object will be created or the existing one
be used.A new object will always be created in that case, but you can get a reference to the string in the pool by calling intern. See the javadoc for intern in the String class.
Kaj -
Dear forum members,
Is it possible to execute a query from a string like this:
DECLARE
thishere VARCHAR2;
BEGIN
f:='from iv_view_cqir_sum where 1=1 ';
select sum(a) into thishere [...];
END;The [...] should be taken from the string f...
Any comments welcome!
Cheers,
JohannYou can do it in this way:
SQL> create table test1(id number);
Table created.
SQL> insert into test1 values(1);
1 row created.
SQL> insert into test1 values(2);
1 row created.
SQL> DECLARE
v_var VARCHAR2 (10) := 'where id=1';
v_count NUMBER;
BEGIN
EXECUTE IMMEDIATE 'select count(1) from test1 ' || v_var
INTO v_count;
DBMS_OUTPUT.put_line (v_count);
END;
1- - - - - - - - - - - - - - - - - - - - -
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Hi all,
I have a table A, in which there is a column currency with integer values having decimal point, i have to just remove the decimal and keep the number as it is.
Ex:- A number 23.45 should be 2345
A number 17.9 should be 179
I have to do this for all the currency values of the table A.
Can someone kindly help me with a query.
regards,Hi,
user10243788 wrote:
Thank you all for replying,
The problem is that there are different rows in table A, i.e many values, so i think we would have to pass this value as variable in runtime.Sorry, I don't understand.
What value do you think you have to pass as a variable? The decimal point character ('.' in America, ',' in Germany)? The number of decimal places? Some value, such as 175?
select to_number(replace (1.23, '.')) from dual;
or
SELECT REPLACE (crncy, '.') AS crncy_w_o_dot
FROM table_x;
how can i use the above query like a loopAny query is like a loop; it finds each row, and does the same sort of thing to each one.
i.e if i have many values like below in the column currency, how can i change them all.Are you saying you have different columns that need to be transformed?
If so, the answer depends on what your data is like, what results you want, and what version of Oracle you're using..
If what you want to do is simple, and the number of columns isn't to big, the best thing is to repeat the formula for every column.
Other options are likely to be slower.
You could write a user-defined fucniton to do the transformation.
You could unpivot the table, so that all the columns to be transformed become one column. You could then pivot the results back to the original number of columns, if necessary.
17.5
23.456
89.9343
43.98121thanks again for your help,Is this your sample data? It looks like just one column. Post some sample data as CREATE TABLE and INSERT statements.
What are the results you want from that data? If you need to pass some parameter to the query, give a couple of examples of different parameters and the different results they produce given the same sample data.
Whenever you have a question, say what version of Oracle you're using.
Edited by: Frank Kulash on Jul 13, 2010 11:05 AM -
Please Help: query matching string value in WHERE clause
Hi Everyone,
I am trying to query customers that has matching first and last name but, I am getting result of every customer that has first and last name. Here is what my query looks like:
SELECT * FROM CUSTOMERS WHERE
CUSTOMER_FNAME IN
'JOHN', 'MIKE'
AND CUSTOMER_LNAME IN
'DOE', 'MILLER'
); I am trying to query customer name that is JOHN DOE and MIKE MILLER but, i get result of all names that has the first/last names not exact match. Is there way i can do that get exact match?
Thanks,
SMFrank Kulash wrote:
Hi,
chris227 wrote:
SMCR wrote:
Thanks everyone for your help!
There are two correct answers, I am using following:I just see one, it's Franks.If fname never contains a '~' (or if lname never contains a '~") then
{code}
where fname||'~'||lname in ('JOHN~DOE', 'MIKE~MILLER');
{code}
will work.Yes, I realized that. For the purpose i am using i will not have any issue with '~'
I did however changed it up a little, here is how it looks like:
{code}
SELECT CUSTOMER_ID, CUSTOMER_FNAME, CUSTOMER_LNAME, DATE_OF_BIRTH
FROM CUSTOMERS
WHERE (CUSTOMER_FNAME||'~'||CUSTOMER_LNAME, DATE_OF_BIRTH) IN
(('JOHN~DOE'), (TO_DATE('20130101', 'YYYYMMDD'))),
(('MIKE~MILLER'), (TO_DATE('20130101', 'YYYYMMDD')))
{code} -
Hi Guys,
I have a Internal Table which is of type string.
After filling My Internal Table has 2 records like below
Details(This is Fieldname in my Internal Table)
1.xxx,yyy,zzz,abc,123,456,Etc.............,
2.abd,134,Etc..............
When I am debugging this I am able to see upto xxx,yy
How to check the full content ,bcoz I need to know whether full data is present or not.
Thanks,
Prasad.In the debugging mode open your internal table "details" and press Ctrl+F11 your internal table get exported to excel
a® -
Refcursor with query as string
Hi,
Is there any performance difference when creating reference sursor with select statement as string.
Case 1:
Declare
p_Result IN OUT SYS_REFCURSOR,
v_Sqlstr VARCHAR2(4000);
begin
v_Sqlstr := 'select * from emp';
OPEN p_Result FOR v_Sqlstr;
end;
Case 2:
Declare
p_Result IN OUT SYS_REFCURSOR,
begin
OPEN p_Result FOR select * from emp;
end;
Is there any performance difference between the above cases.
Thanks in advance
RizlyHandle: RizlyFaisal
Status Level: Newbie
Registered: Mar 21, 2007
Total Posts: 175
Total Questions: 32 *(29 unresolved)*
Name Rizly
No -
Query for finding Oracle CPU and memory utilization and
I want to gather the report using Oracle views in the same formatas of the report which the top utility gives for Sun-Solaris OS processes.
I want the same type of report for Orcale database processes including all the user processes and the oracle internal processes.
can any body tell me if it is possible.
I am writing the top utility report format below and its contents:
CPU-processor number
TTY-Terminal interfaces used
PID-Process id number
USERNAME-Name of the owner of the process
PRI- Current priority of the process
NI- Nice value
SIZE- total size of process (text+data+stack)
RES-resident size of process
STATE- current state of process
TIME-number of system and CPU seconds the process has consumed
%WCPU-weighted CPU
%CPU-raw CPU
COMMAND- name of the command
thanks in advanceSee this thread Re: Oracle Shared DB instance utilization
-
SQL Server 2008R2 SP2 Query optimizer memory leak ?
It looks like we are facing a SQL Server 2008R2 queery optimizer memory leak.
We have below version of SQL Server
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
Jun 28 2012 08:36:30
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
The instance is set MAximum memory tro 20 GB.
After executing a huge query (2277 kB generated by IBM SPSS Clementine) with tons of CASE and a lot of AND/OR statements in the WHERE and CASE statements and muliple subqueries the server stops responding on Out of memory in the internal pool
and the query optimizer has allocated all the memory.
From Management Data Warehouse we can find that the query was executed at
7.11.2014 22:40:57
Then at 1:22:48 we recieve FAIL_PACE_ALLOCATION 1
2014-11-08 01:22:48.70 spid75 Failed allocate pages: FAIL_PAGE_ALLOCATION 1
And then tons of below errors
2014-11-08 01:24:02.22 spid87 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:02.22 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:02.22 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:02.30 Server Error: 17312, Severity: 16, State: 1.
2014-11-08 01:24:02.30 Server SQL Server is terminating a system or background task Fulltext Host Controller Timer Task due to errors in starting up the task (setup state 1).
2014-11-08 01:24:02.22 spid74 Error: 701, Severity: 17, State: 123.
2014-11-08 01:24:02.22 spid74 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:13.22 Server Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:13.22 spid87 Error: 701, Severity: 17, State: 123.
2014-11-08 01:24:13.22 spid87 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:13.22 spid63 Error: 701, Severity: 17, State: 130.
2014-11-08 01:24:13.22 spid63 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:13.22 spid57 Error: 701, Severity: 17, State: 123.
2014-11-08 01:24:13.22 spid57 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:13.22 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:18.26 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:24.43 spid81 Error: 701, Severity: 17, State: 123.
2014-11-08 01:24:24.43 spid81 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:18.25 Server Error: 18052, Severity: -1, State: 0. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:18.25 Server BRKR TASK: Operating system error Exception 0x1 encountered.
2014-11-08 01:24:30.11 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:30.11 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:35.18 spid57 Error: 701, Severity: 17, State: 131.
2014-11-08 01:24:35.18 spid57 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:35.18 spid71 Error: 701, Severity: 17, State: 193.
2014-11-08 01:24:35.18 spid71 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:35.18 Server Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:35.41 Server Error: 17312, Severity: 16, State: 1.
2014-11-08 01:24:35.41 Server SQL Server is terminating a system or background task SSB Task due to errors in starting up the task (setup state 1).
2014-11-08 01:24:35.71 Server Error: 17053, Severity: 16, State: 1.
2014-11-08 01:24:35.71 Server BRKR TASK: Operating system error Exception 0x1 encountered.
2014-11-08 01:24:35.71 spid73 Error: 701, Severity: 17, State: 123.
2014-11-08 01:24:35.71 spid73 There is insufficient system memory in resource pool 'internal' to run this query.
2014-11-08 01:24:46.30 Server Error: 17312, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:51.31 Server Error: 17053, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:51.31 Server Error: 17300, Severity: 16, State: 1. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
2014-11-08 01:24:51.31 Logon Error: 18052, Severity: -1, State: 0. (Params:). The error is printed in terse mode because there was error during formatting. Tracing, ETW, notifications etc are skipped.
Last error message is half an hour after the inital Out of memory at 2014-11-08 01:52:54.03. Then the Instance is completely shut down
From the memory information in the error log we can see that all the memory is consumed by the QUERY_OPTIMIZER
Buffer Pool Value
Committed 2621440
Target 2621440
Database 130726
Dirty 3682
In IO
0
Latched
1
Free
346
Stolen 2490368
Reserved 0
Visible 2621440
Stolen Potential 0
Limiting Factor 17
Last OOM Factor 0
Last OS Error 0
Page Life Expectancy 28
2014-11-08 01:22:48.90 spid75
Process/System Counts Value
Available Physical Memory 29361627136
Available Virtual Memory 8691842715648
Available Paging File 51593969664
Working Set 628932608
Percent of Committed Memory in WS 100
Page Faults 48955000
System physical memory high 1
System physical memory low 0
Process physical memory low 1
Process virtual memory low 0
MEMORYCLERK_SQLOPTIMIZER (node 1) KB
VM Reserved 0
VM Committed 0
Locked Pages Allocated 0
SM Reserved 0
SM Committed 0
SinglePage Allocator 19419712
MultiPage Allocator 128
Memory Manager KB
VM Reserved 100960236
VM Committed 277664
Locked Pages Allocated 21483904
Reserved Memory 1024
Reserved Memory In Use 0
On the other side MDW reports that the MEMORYCLERK_SQLOPTIMIZER increases since the execution of the query up to the point of OUTOF MEMORY, but the Average value is 54.7 MB during that period as can be seen on attached graph.
We have encountered this issue already two times (every time the critical query is executed).Hi,
This does seems to me kind of memory Leak and actually it is from SQL Optimizer which leaked memory from buffer pool so much that it did not had any memory to be allocated for new page.
MEMORYCLERK_SQLOPTIMIZER (node 1) KB
VM Reserved 0
VM Committed 0
Locked Pages Allocated 0
SM Reserved 0
SM Committed 0
SinglePage Allocator 19419712
MultiPage Allocator 128
Can you post complete DBCC MEMORYSTATUS output which was generated in errorlog. Is this the only message in errorlog or there are some more messages before and after it.
select (SUM(single_pages_kb)*1024)/8192 as total_stolen_pages, type
from sys.dm_os_memory_clerks
group by typeorder by total_stolen_pages desc
and
select sum(pages_allocated_count * page_size_in_bytes)/1024,type from sys.dm_os_memory_objects
group by type
If you can post the output of above two queries with dbcc memorystaus output on some shared drive and share location with us here. I would try to find out what is leaking memory.
You can very well apply SQL Server 2008 r2 SP3 and see if this issue subsides but I am not sure whether this is fixed or actually it is a bug.
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP
Maybe you are looking for
-
Skype not work on new (3 week old) mac mini but does work on new macbookpro
I have language lessons online via skype - just voice not video. I have a new mac mini (2.26ghz, 160gb, 2gb). When I have my lessons I have terrible problems with audio quality. All "crackly" so much so that my teacher can hardly hear me. However, if
-
Universal Worklist items open in new window instead of existing frame
After our recent upgrade we noticed that workitems in Universal Worklist open in new window instead of existing frame. Do you know if there is a system or universal setting to make all the workitems open in existing frame? I know we can change the
-
PDF links (7.11.2.2) and behavior on the web
Hello all, I'm trying to generate a PDF file (from scratch, using a C++ library - but that's not relevant to my question) that uses links to specify the location of linked files relative to the root of a drive - NOT relative to the PDF file itself (i
-
I installed the new oracle 10g home, before upgrade the main database from 9i to 10g, i want to create a testing instance just to test if i can start sqlplus from 10g home. What's the procedure to create such instance? Thanks!
-
When is Apple going to address this ITUNES CPU 100 percent problem
This is getting one everyones nerves.