Select ename from emp where ename like LIKE 's%';
Hi friends,
select ename from emp where ename like LIKE 's%';
output am geting like this naseer
anusha
basha
But I want to display like this naeer anuha baha
784585 wrote:
Hi friends,
select ename from emp where ename like LIKE 's%';
output am geting like this naseer
anusha
basha
But I want to display like this naeer anuha baha
Use REPLACE function:
SQL> select replace('naseer','s','') replace from dual;
REPLACE
naeerKamran Agayev A.
Oracle ACE
My Oracle Video Tutorials - http://kamranagayev.wordpress.com/oracle-video-tutorials/
Similar Messages
-
I have a big problem
I have to check the data for quality data
Lets say i have to check data in emp table
First i have to check whether the empno is of type number
IF empno=number then
if ename starts with a particualar format then
---printouts and this procedure goes on for about 10 coulumns
I have designed a hard coded procedure where I input table name and column name and the procedure does the checks and give out result
I have planned to call that procedures here for each checks
its like i make the procedure to execute and the procedure returns rowid of the correct data
now i have to apply the second procedure where input is all the rowids of previous procedure and it goes on
I even dont know whether procedure is correct or function is correct
Its like select * from emp where ename=(procedure1(procedure2(procedure3)));
each procedure's output is Rowids only which satisfy a particular format of data
Please explain me in details
Please please help me.Nested calls are not the best of ideas. Ignoring that for a moment, there are a couple of ways to address this requirement in Oracle. One of these, and likely one of the more scalable ways, is to use Pipeline Table Functions.
The following code demonstrates the basics of this approach, using pipelined table functions to perform validation checks on data.
SQL> -- generic type to serve as input cursors to the validation functions
SQL> create or replace type TFormatCheckRow as object
2 (
3 row_identifier varchar2(30),
4 value varchar2(100)
5 );
6 /
Type created.
SQL>
SQL> -- validation functions returns the rowid of rows that are valid
SQL> create or replace type TRowID as object
2 (
3 row_identifier varchar2(30)
4 );
5 /
Type created.
SQL>
SQL> create or replace type TRowIDTable is table of TRowID;
2 /
Type created.
SQL>
SQL>
SQL> create or replace package LIB is
2
3 type TCursor is REF CURSOR;
4 end;
5 /
Package created.
SQL>
SQL> -- sample validation function to check if the value is a valid NUMBER, and
SQL> -- if so will return the rowid of that row for further processing
SQL> create or replace function ValidateNumber( c LIB.TCursor ) return TRowIDTable
2 pipelined is
3
4 MAX_FETCH_SIZE constant number := 100;
5 type TBuffer is table of TFormatCheckRow;
6
7 buffer TBuffer;
8
9 function IsNumber( val varchar2 ) return boolean is
10 n number;
11 begin
12 n := TO_NUMBER( val );
13 return( TRUE );
14 exception when OTHERS then
15 return( FALSE );
16 end;
17
18 begin
19 loop
20 fetch c bulk collect into buffer limit MAX_FETCH_SIZE;
21
22 for i in 1..buffer.Count
23 loop
24 if IsNumber( buffer(i).value ) then
25 PIPE ROW( TRowID( buffer(i).row_identifier ) );
26 end if;
27 end loop;
28
29 exit when c%NOTFOUND;
30 end loop;
31
32 close c;
33
34 return;
35 end;
36 /
Function created.
SQL> show error
No errors.
SQL>
SQL>
SQL> -- a sample table to check
SQL> create table foo_tab
2 (
3 some_value varchar2(20)
4 )
5 /
Table created.
SQL>
SQL>
SQL> -- put some data into the table
SQL> insert
2 into foo_tab
3 select
4 object_id
5 from all_objects
6 where rownum < 11
7 /
10 rows created.
SQL>
SQL> insert
2 into foo_tab
3 select
4 SUBSTR(object_name,1,20)
5 from all_objects
6 where rownum < 11
7 /
10 rows created.
SQL>
SQL> commit;
Commit complete.
SQL>
SQL> -- return rowids of all rows from FOO_TAB where the column SOME_VALUE is a valid number
SQL> select
2 row_identifier
3 from TABLE(ValidateNumber( CURSOR(select TFormatCheckRow(f.rowid,f.some_value) from foo_tab f) ))
4 /
ROW_IDENTIFIER
AAAOQKAAEAAAAFQAAA
AAAOQKAAEAAAAFQAAB
AAAOQKAAEAAAAFQAAC
AAAOQKAAEAAAAFQAAD
AAAOQKAAEAAAAFQAAE
AAAOQKAAEAAAAFQAAF
AAAOQKAAEAAAAFQAAG
AAAOQKAAEAAAAFQAAH
AAAOQKAAEAAAAFQAAI
AAAOQKAAEAAAAFQAAJ
10 rows selected.
SQL>
SQL>
SQL> -- list the rows that contain valid numbers
SQL> with ROWID_LIST as
2 (
3 select
4 row_identifier
5 from TABLE(ValidateNumber( CURSOR(select TFormatCheckRow(f.rowid,f.some_value) from foo_tab f) ))
6 )
7 select
8 *
9 from foo_tab f
10 where f.rowid in (select row_identifier from ROWID_LIST)
11 order by 1
12 /
SOME_VALUE
258
259
311
313
314
316
317
319
605
886
10 rows selected.
SQL> -
Whats the meaning of plus in query : select employeename from emp where emp
Hi All,
Can someone please explain me whats the meaning of plus sign in following SQL. I have nevercome across this syntax
select employeename from emp where empid(+) >= 1234.Example of equivalent queries using oracle syntax and ansi syntax
SQL> ed
Wrote file afiedt.buf
1 select d.deptno, d.dname, e.ename
2 from dept d, emp e
3* where d.deptno = e.deptno (+)
SQL> /
DEPTNO DNAME ENAME
20 RESEARCH SMITH
30 SALES ALLEN
30 SALES WARD
20 RESEARCH JONES
30 SALES MARTIN
30 SALES BLAKE
10 ACCOUNTING CLARK
20 RESEARCH SCOTT
10 ACCOUNTING KING
30 SALES TURNER
20 RESEARCH ADAMS
30 SALES JAMES
20 RESEARCH FORD
10 ACCOUNTING MILLER
40 OPERATIONS
15 rows selected.
SQL> ed
Wrote file afiedt.buf
1 select d.deptno, d.dname, e.ename
2* from dept d left outer join emp e on (d.deptno = e.deptno)
SQL> /
DEPTNO DNAME ENAME
20 RESEARCH SMITH
30 SALES ALLEN
30 SALES WARD
20 RESEARCH JONES
30 SALES MARTIN
30 SALES BLAKE
10 ACCOUNTING CLARK
20 RESEARCH SCOTT
10 ACCOUNTING KING
30 SALES TURNER
20 RESEARCH ADAMS
30 SALES JAMES
20 RESEARCH FORD
10 ACCOUNTING MILLER
40 OPERATIONS
15 rows selected.
SQL> -
Create table bulk_load as select ename from emp where 1=2
The Above Query will create a new table using the strucure of old but there will be no data..
Kindly explain me what is meant by "where 1=2"?
Is it referring the table or column or for just testing the query??Is not a rule that you always must use 1=2... look this example:
sql >> create table t as
2 select * from all_objects;
Table created.
sql >> select count(*) from t;
COUNT(*)
43975
sql >> create table ttt as
2 select * from t where rownum=0;
Table created.
sql >> create table tt as
2 select * from t where 9=4;
Table created. -
Dear team support,
I have a problem with my WhatsApp Messenger.
my whatsapp wont save message history. couse error.
Error: Sqlite Error (schema update):
net.rim.device.api.database.DatabaseException: SELECT name FROM sqlite_master WHERE type = 'index' AND name = 'chat_history_jid_index': disk I / O error (10).
Please advise me how can i solve my memory card issue..
Thanksls -l /var/run/lighttpd/
And how are you spawning the php instances? I don't see that in the daemons array anywhere.
EDIT: It looks like the info in that page is no longer using pre-spawned instances, but lighttpd adaptive-spawn. The documentation has been made inconsistent it looks like.
You will note that with pre-spawned information, the config looks different[1].
You need to do one or the other, not both (eg. choose adaptive-spawn, or pre-spawn..not both).
[1]: http://wiki.archlinux.org/index.php?tit … oldid=8051 "change" -
We just applied "SAP Bundle Patch 10.2.0.4.5 - 201010" in our development system.
We completed all the post installation activities.
In tail end - when we execute subjected command, 39 rows returned.
Very First --- May we understand What is the negative impact on Oracle system?
Secondly -- Do we need to make these rows to "ZERO" is must ?
Finally - How to make them to "ZERO"
2 lines expert advise...will enable us to move forward.
Rgds
==========
COMMAND
==========
SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID';
OBJECT_NAME
LOGMNR_KRVRDLUID3
DBMS_SQLTCB_INTERNAL
DBMS_LOGMNR_FFVTOLOGMNRT
DBMS_LOGMNR_OCTOLOGMNRT
DBMS_RULE_EXP_UTL
DBMS_LOGSTDBY
DBMS_AW_EXP
DBMS_SNAP_INTERNAL
DBMSOBJG_DP
DBMS_REPCAT_EXP
DBMS_STREAMS_TBS_INT_INVOK
DBMS_FILE_GROUP_UTL
DBMS_FILE_GROUP_UTL_INVOK
DBMS_STREAMS_MT
DBMS_LOGREP_EXP
DBMS_LOGREP_IMP
DBMS_STREAMS_RPC
DBMS_STREAMS_DATAPUMP
DBMS_STREAMS_DATAPUMP_UTIL
DBMS_STREAMS_TBS_INT
DBMS_STREAMS_TBS_INT_INVOK
DBMS_STREAMS_TABLESPACE_ADM
DBMS_FILE_GROUP_UTL
DBMS_FILE_GROUP_UTL_INVOK
DBMS_FILE_GROUP
DBMS_FILE_GROUP_INTERNAL_INVOK
DBMS_FILE_GROUP_EXP
DBMS_FILE_GROUP_IMP_INTERNAL
DBMS_REDEFINITION
DBMS_CDC_DPUTIL
LOGMNR_KRVRDREPDICT3
DBMS_CDC_DPUTIL
DBMS_CDC_EXPDP
DBMS_CDC_EXPVDP
DBMS_CDC_IMPDP
DBMS_SCHEMA_COPY
UTL_RECOMP
DBMS_SQLTUNE_INTERNAL
DBMS_CDC_DPUTIL
39 rows selected.
SQL>
==========Hi,
there has been an issue with an earlier set of bugfixes or an older CPU patch.
It did invalidate the catproc component.
Check: select comp_id,status, version from dba_registry;
if CATPROC is invalid, shutdown and startup your DB.
run
@?/rdbms/admin/catproc.sql
it can run between 10 and 25 minutes depending on horse powers.
Check again: select comp_id,status, version from dba_registry;
CATPROC should now be valid.
If yes run utlrp.sql again and your errors will be gone.
If not, your issue is something else.
Volker -
hi
SELECT fcpp.concurrent_request_id req_id, fcp.node_name, fcp.logfile_name
FROM fnd_conc_pp_actions fcpp, fnd_concurrent_processes fcp
WHERE fcpp.processor_id = fcp.concurrent_process_id
AND fcpp.action_type = 6
AND fcpp.concurrent_request_id = &&request_id
;its returning logfile name ...
AND
select count(*) from fnd_conc_pp_actions where action_type=6;its returning 460 rows.
i want to know what is action_type?
and how to know about all attribute about this fnd tables?
regardsHelios- Gunes EROL wrote:
Hi;
For your question please check e-trm site. You can find relation&explanation&integration and more on e-trm site.(etrm.oracle.com)
Regard
Heliosetrm is not opening. -
About SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WHERE PARAMETER =""
I am developing a web application based on Oacle 10g .But after the DBServe was startedup for about 5~6 hours, the max connection process exceeded. From the DB Administration Tool it shows that there were many INACTIVE Connections which executed
SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WHERE PARAMETER ='NLS_DATE_FORMAT'
But it seems that this is called by the JDBC driver, not my application. How to avoid this, or release the inactive connection?
By the way,who and when call that sql?
Thanks a lot.By the way,who and when call that sql?Also for this you can take an 10046 level 8 sql trace and format the output with sys=yes option of tkprof - http://tonguc.wordpress.com/2006/12/30/introduction-to-oracle-trace-utulity-and-understanding-the-fundamental-performance-equation/
Since we are talking about a web application you may use a database logon trigger to start sql trace for your application user, or if possible you may set sql_trace database parameter to true at instance level for a while and since you are at 10g you can use new package dbms_monitor and trcsess utility - http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm#sthref2001
Best regards. -
Delete from wwv_flow_file_objects$ where file name like 'p1_name'
I am having an issue deleting an object in my apex application. I have uploaded an object into the application i can open the application but i cannot delete from that application. I can delete it when i login to the server and provide this command:
delete from wwv_flow_file_objects$ where filename like 'Whatever.pdf';
I am looking for the code to assign to a button and how do i get it to process.
process
the code i currently have is this: DELETE from APEX_APPLICATION_FILES WHERE name = :P4_NAME and it is not working. What am i missing.
process point = on submit
run process = once per session
when button is pressed pdf_remove
name: pdf_delete
button:
action when clicked
action - submit page
execute validation - no
database action - no database action "it does not show my process"Christian
Thank you very much,
I switched to Apex Listener over Weblogic Server that was already working, just added a new managed server and deployed apex.war and i.war on it.
the server resources are very good now. -
Select data from table where field is initial
I have table that has 10 million records.
I want to select data from this table where certain date field is blank.
*SELECT * FROM table*
INTO TABLE internal table
WHERE PSTNG_DATE = BLANK.
Does anybody know how to select data from data base table when certain field is blank.
I cont select all data once and delete which i dont want, the table is big, it will blow up app server.
thanks in advance,
Sachin
Moderator: Pls do not lock the posting instead provide me the link, its disrespecting.Respect the forum rules and common sense, and you will be respected.
"how to select data from a database table when the field is blank" is very basic, and basic questions will be locked, because they have been asked many times and you can find the answer yourself with a little effort. There is nothing disrespectful about it.
Thread locked.
Thomas -
Selecting datas from tables where tbale name is store in a row
Hi
I need to select datas from several different table (QE01, QE02, QE06, QEXXetc.).
The code of the tables I need to select from is store in another table.
Here's an example:
In the table JOURNAL, I have several entries:
01
06
21
31
These are the codes of the tables I need to select datas from:
QE01
QE06
QE21
QE31
I can't use variables in here, how could that be done ?Hi,
This should not be a question on how to query data, but rather on how to store them.
You did not mention any version, but I suggest you read about partitioning,
http://download.oracle.com/docs/cd/E11882_01/server.112/e25789/schemaob.htm#CNCPT112
Could be that especially exchange partition is interesting.
My guess is that these tables are created on the fly as part of data loads?
If so, complete that ETL process by exchanging the just loaded data into a partioned table. And your problem of what to query has disappeared.
Regards
Peter -
Select lines from DB where keys not already selected
This must have been asked many times, but I haven't been able to find an answer:
How do I best select a large number of entries from a table X where the keys of X
are not already cached in a (also large) internal table t?
There are three possibilities I can think of, one of which doesn't actually work, although
I think it should.
1. Convert t to a range table, where all entries have the form sign=E option=EQ (or
sign=I option=NE - I'm confused about the difference in meaning. Which is right?)
2. Use "for all entries". The documentation of FAE leads me to believe that this
should be possible, because the docs only talk of using logical expressions in general
with FAE, not equality specifically. However, using inequality does not give the right result,
i. e.
select * from X for all entries in t where k NE t-k
does not work. Am I missing something?
3. Do a select loop and read t before accepting a line. Although t is a hash table, this is
probably the worst as regards performance.
-- SebastianIn the 2nd option, just check the statment
select * from X into table itab for all entries in t where k NE t-k -
Hi, I have a quick question I hope someone can help me with. I'm a student and what I'm looking for should be easy but I can't find any information on it.
Here's my code, it's probably self-explanatory but to clarify I'm trying to get a list of "Captains" in the order of who has the most wins.
The problem is that the database tables have thousands of "Captains" and I'm only supposed to look at 200 specific "Captains" which have their ssn in a specific arraylist and then return the top 80 "Captains" from that selection.
Something like this...
SELECT first 80 E.name, L.ssn, COUNT(L.wins) as Wins
FROM log L, employees E
where type matches "[Captain]"
and E.ssn = L.ssn
and L.ssn IN (...arraylist...) // How do I loop through the arraylist but still return a list of the top 80 winners?
group by E.name, L.ssn
order by Wins desc;
Should I start by taking the list of social security numbers from the arraylist and insert them into a temporary table and then use that temporary table to base my selection on?
For example:
int rows = 0;
PreparedStatement ps = conn.prepareStatement("INSERT INTO TEMP captainsTemp (ssn) VALUES(?)");
Iterator i = myArrayList.iterator();
while (i.hasNext())
// Set the variables
for (int pos = 1; pos <= 63; pos++)
String s = (String)i.next();
ps.setString(pos,s);
// insert a row
rows += ps.execute();
...and then below that I could use
"SELECT * FROM captains
WHERE ssn IN (SELECT * FROM captainTemp)..."
This looks like an ugly solution and I'm not sure if it works, sessionwise..
Everything's written in Java and SQL.
If you have any thoughts on this I would be most grateful.
I should add that this is NOT a school assignment but something I'm trying to figure out for my work...
Many thanks,
sincerely,
JT.hi,
Ignore my previous response. Try out this one. It should help you.
Lets take the example of EMP table (in Oracle's SCOTT Schema). The following is the description of the table.
SQL> desc emp
Name Null? Type
EMPNO NOT NULL NUMBER(4)
ENAME VARCHAR2(10)
JOB VARCHAR2(9)
MGR NUMBER(4)
HIREDATE DATE
SAL NUMBER(7,2)
COMM NUMBER(7,2)
DEPTNO NUMBER(2)
SQL> select ename from emp;
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLER
Say, the ArrayList contains 3 names CLARK,KING & MILLER. You want to loop through the ArrayList for the ENAME values.
First construct a string like below from the ArrayList.
"ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER'";
Append this string to the normal SELECT Query
Query :
select ename from emp where ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER'
Here you get the desired output & thats pretty fast because you just do it once !!!
SQL> select ename from emp where ename in 'CLARK' OR ename in 'KING' or ename in 'MILLER';
ENAME
CLARK
KING
MILLER
you can extend this to your Query also.
thanks,
Sriram -
How can I select columns from a table EMP, using Select statement?.
Hi Friends,
How can I select columns from a table EMP?.
I want to select columns of EMP table, using select statement.
Please reply me urgently.
ShahzadSomething like this:
scott@DBA> select empno,ename,job from emp;
EMPNO ENAME JOB
7369 SMITH CLERK
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK
7900 JAMES CLERK
7902 FORD ANALYST
7934 MILLER CLERK
14 rows selected.Check the documentation:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#sthref9697
Message was edited by:
Delfino Nunez -
Hi all,
im trying to set a block default where clause in the pre-query trigger of my block "customer_settlement" , to query the records that exist in a customers table like this, where the customer_name is variable based on the value entered by the user in enter-query mode before hitting the F8 key , the statement is :
set_block_property( 'customer_settlement' , default_where ,
' fk_cust_code in ( select customer_code from customers where customer_name like %' || :customer_settlement.customer_name ||'% )' );
the query doesnt work and giving me an error " unable to perform query" , notice that :customer_settlement.customer_name is an item in the block , the user change it and would like to query upon it , and its not a base table item on customer_settlement block its on customers table only . I tried all combinations of '%' and || but it seems that oracle can't see the value In the customer_name field.
any help is highly thanked.
im using Oracle form 9.0.4 and Oracle 10g Db.
Regards,
IKQHi,
does this work ?
set_block_property( 'customer_settlement' , default_where ,
' fk_cust_code in ( select customer_code from customers where customer_name like '''%' || :customer_settlement.customer_name ||'%''' )' );
Frank
Maybe you are looking for
-
How do I find out where FCP saved my captured media?
I'm editing a project and my original source capture on one of my clips needs to be recaptured because of some corruption on the very front part of the file which is making it impossible to insert any of the video track from this capture into my time
-
I just recently built a new computer, using the same hard drive i had but reformatting it with all the new components. I backed up all my files on the old version of the hdd, and i thought of using my iPod nano as a backup for all my music files, con
-
Please assist, my mac is freezing after being launched. It has been happening since I have installed Lion. Cannot do anything, it just freezes or seems dead slow. What to do ?
-
Coverting CST server time to UTC time
hi friends is there any FM to convert CST server time to UTC time Thanks in advance with regards s.janagar
-
HI All, could you please advice if there is any way to download the sent items which has been sent via webmail to the local outlook. other than move it to the inbox and download it. we are using iPlanet Messaging Server 5.2 Patch 2. Thanks All, K.Sad