SQL Command for string
Using sql command, how do I get rid of the 'to' in my string
Factoryto_510 ->> Factory_510
Thank you very much!
REPLACE
Similar Messages
-
Need help on Sql command for count
Hi,
I have the following table.
Temp_Set Table
ID Names Action
1 John Delete
2 John Add
3 Mary Update
4 Sim Add
5 Sim Update
How do I do a SELECT sql command for count(names) > 1 ?
Please kindly advise me. Thank you very much.It doesnt work when I do this
SELECT * FROM Temp_Set
HAVING Count(names) > 1
It prompts me the following error:
ORA-00937: not a single-group group function
00937.00000 - "not a single-group group function"
*Cause:
*Action:
Error at Line:16 Column:7i am not sure but you can try this:
SELECT B.* FROM
(SELECT NAMES, COUNT(1) CNT FROM TEMP_SET GROUP BY NAMES) A, TEMP_SET B
WHERE A.NAMES = B.NAME
AND CNT > 1 -
I am attempting to write a SQL command for a Crystal report that links tables from two different databases, both of them Progress databases.I keep getting syntax errors that the table from the other db (meaning not the one I opened in DB Expert) can't be found. If someone has experience with Progress or otherwise has any ideas it would be greatly appreciated.
I'm not familiar with Progress, but does it have something like MS SQL's OPENQUERY using Linked Servers (which allows you to query a different DB server from the one you're connected to)? If not, you'll probably have to use two different SQL Commands to base the report on, then use Crystal to link the returned data sets. (I'm assuming "a different database" means "a different database server", not a different database on the same server instance...)
HTH,
Carl -
What is the sql command for SELECT with OR condition
Hi
What is the correct sql command for doing select with or condition??
SELECT * from TempData
WHERE port = '123'
OR serialnumber = '555'
So if there is a port = 123 or if there is a serialnumber = 555, I will get a successful select.
Thanks for helping a newbie!!Hi
What is the correct sql command for doing select with
or condition??
SELECT * from TempData
WHERE port = '123'
OR serialnumber = '555'
So if there is a port = 123 or if there is a
serialnumber = 555, I will get a successful select.
Thanks for helping a newbie!!Make sure you bracket your OR conditions
eg
SELECT * from TempData
WHERE column = 'VALUE'
and port = '123'
OR serialnumber = '555'
is read as
SELECT * from TempData
WHERE (column = 'VALUE'
and port = '123' )
OR serialnumber = '555'
which is not the same as
SELECT * from TempData
WHERE column = 'VALUE'
and ( port = '123'
OR serialnumber = '555' ) -
PL?SQL block for string concatenation
Hi,
I have written the following procedure for concatenating the strings from different tables. This is working fine if I run this is SQL commands. But If I put the same in HTMLDB report region, I am getting error "Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-06550: line 1, column 8: PLS-00103: Encountered the symbol "" when expecting one of the following: begin function package pragma procedure subtype type use form current cursor"
I am not able to resolve this.. Please help me..
DECLARE
CURSOR C_Lscape
IS
SELECT PL.pl_id pl_id,PL.partner_name partner_name,
PL.area area,PL.region region,PL.country country,
PL.tier tier,PL.type type,PL.category category,
PL.market_segment market_segment,PL.parent parent,
PL.geo_focus geo_focus,PL.opn_id opn_id,PL.opn_level opn_level,
PL.opn_status opn_status,PL.opn_expirydate opn_expirydate,
pd.types types,pd.apac apac,pd.region pd_region,
pd.country pd_country,pd.value value,pd.sub_value sub_value,
acc.acc_territory_assigned acc_territory_assigned,acc.industry industry,
acc.industry_segment industry_segment,acc.solution_segment solution_segment,
acc.product product,acc.solution_name solution_name,acc.apac acc_apac,
acc.region acc_region,acc.country acc_country,
ad.agreement_type agreement_type,ad.adreement_date adreement_date,ad.credithold_status credithold_status,
ad.agreement_number agreement_number
FROM PARTNER_LANDSCAPE_PL PL
,PARTNERLANDSCAPE_DETAILED PD
,AGREEMENT_DETAILS AD
,ACCELERATE_SOLUTION ACC
WHERE PL.pl_id=pd.pl_id
AND ACC.PL_ID=PL.PL_ID
AND AD.PL_ID=PL.PL_ID
AND (( PL.partner_name=:p18_partner
AND PL.partner_name!='%null%')
OR ( PL.country=:p18_country
AND PL.country!='%null%')
OR ( PL.region=:p18_region
AND PL.region!='%null%')
OR ( PL.area=:p18_area
AND PL.area!='%null%')
OR ( PL.category=:p18_category
AND PL.category!='%null%')
OR ( PL.market_segment=:p18_marketsegment
AND PL.market_segment!='%null')
OR ( PL.tier=:p18_tier
AND PL.tier!='%null%')
OR ( PL.GEO_FOCUS=:p18_geofocus
AND PL.GEO_FOCUS!='%null%')
OR ( pd.sub_value=:p18_industry
OR :p18_industry!='')
OR ( pd.value=:p18_gtmi
OR :p18_gtmi!='')
OR ( pd.value=:p18_productfamily
OR :p18_productfamily!='')
OR ( pd.sub_value=:p18_solutionarea
OR :p18_solutionarea!='')
l_lscape VARCHAR2(4000);
BEGIN
FOR i IN C_Lscape
LOOP
l_lscape := i.pl_id||' : '||i.partner_name||' : '||i.area||' : '||i.region||' : '||i.country||' : '||i.tier||' : '||i.type||' : '||i.category
||' : '||i.market_segment||' : '||i.parent||' : '||i.geo_focus||' : '||i.opn_id||' : '||i.opn_level||' : '||i.opn_status
||' : '||i.opn_expirydate||' : '||i.types||' : '||i.apac||' : '||i.region||' : '||i.pd_country
||' : '||i.value||' : '||i.sub_value||' : '||i.acc_territory_assigned||' : '||i.industry
||' : '||i.industry_segment||' : '||i.solution_segment||' : '||i.product||' : '||i.solution_name
||' : '||i.acc_apac||' : '||i.acc_region||' : '||i.acc_country||' : '||i.agreement_type||' : '||i.adreement_date
||' : '||i.credithold_status||' : '||i.agreement_number;
END LOOP;
dbms_output.put_line(l_lscape);
END;
Regards,
PaI'm doing something similar to what you want to accomplish.
First, I created a view that joins the master and detail tables together. The view uses the STRAGG function ahead of time to concatenate multiple details into one "column" (or field).
Next, in my report region, the SQL query lloks like :
SELECT dep_id, dev_st, oper_tp, sig, NAME,
commod, commod_group,
MIN (usgs_num) KEEP (DENSE_RANK FIRST ORDER BY mt_rec ASC) usgs_num,
MIN (model_name) KEEP (DENSE_RANK FIRST ORDER BY mt_rec ASC) model_name,
MIN (country) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) country,
MIN (state_prov) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) state_prov,
MIN (county) KEEP (DENSE_RANK FIRST ORDER BY l_line ASC) county,
MIN (lat_dec) KEEP (DENSE_RANK FIRST ORDER BY g_line ASC) lat_dec,
MIN (lon_dec) KEEP (DENSE_RANK FIRST ORDER BY g_line ASC) lon_dec,
mas_id, mrds_id
FROM NEW_MASTER_QUERY1
WHERE dep_id IN
(SELECT dep_id
FROM search_table where &P3_WHERE_CLAUSE. )
&P3_SEARCH_AREA.
GROUP BY dep_id, dev_st, oper_tp, sig, NAME, commod, commod_group, mas_id, mrds_idEach of the lines above with the MIN() function are "fields" which come from different child tables. My view is getting data from 6 tables, and I only display the data in one line.
Hope this helps some.
Bill Ferguson -
I have a database with fields containing large amounts of text. I wish to be able to search the text in the database using a sql command. I have a number of problems:
1. I will not know in advance how many words the user will be searching for eg 'Holidays' or 'Holidays in England' so how can I split these up and search effectively?
2. What is the SQL command to use to check in the database field to see if it has any of the related strings?
Any help would be greatly appreciated.1.Use StringTokenizer to split the words in your search string
StringTokenizer st = new StringTokenizer("query_string"," ");
2.Suppose it has 2 tokens then, construct a query like this, (You can use st.countTokens() to get the token count)
Select * from table where col1 like '%token1%' or col1 like '%token2%'
Hope this helps.
Sudha -
SQL Command for deleting T-Code for roles
Hi Experts
I want to delete the transaction from the role name by using SQL Command in MS-SQL Server instead of going to /npfcg -> zwa_xyz (role name for user) and transaction code is CR01,CR01,CA01 Etc.,
I have so many transaction code which is taking time to delete one by one.
So is there any SQL Statement to delete the t-code for that rolename
Delete from tablename where t-code=xyz and rolename in ('zwa_xyz',zwa_123')
regardsHey,
SAP does not support executing update/insert/delete SQLs on their tables,
(the only SQL they support are select, and updates that they publish in their official site, such as notes in service.sap.com/notes)
is is probably due to the fact that sap contains about 30,000 of table,
and sometimes SAP uses cluster tables (which are difficult to handle in DB)
in addition, each and every SP adds/remove table or changes existing tables.
For example, you probably don't know that changing rule, would
create a change document (cluster table - CDHDR, CDPOS and etc),
If you want, it is very easy to get the full list of the table (and the sql) that are updated
(as I mentioned before, it is not recommended to run this sql, because it is not supported!!!)
just run transaction ST05 while deleting transaction from role,
when you display the list, press shift+F8 (or summerized trace from the menu),
and they search (Ctrl+F) the words: update or insert or delete.
You can use standard API such as BAPIs (such as BAPI_USER_*)/IDOCs(such as USERCHANGE),
and execute them from the portal and any other place (even in EXCEL or OS->meaning command line).
Here more information on executing RFCs:
1. in order to execute an RFC from excel, you should install SAP gui on the client that would execute the RFCs to the SAP, and you would have to write VBA code.
2. in order to execute an RFC from command line, this is a little bit more difficult,
sap provide RFC sdk (in service.sap.com/SWDC)
3. in order to execute an RFC from .net you can use the .net connector,
more information is here:
NW RFC SDK - is there a guide somewhere?
4. You can also, execute an RFC using Web service,
by creating web-service from the RFC in SE37.
I guess It will take more time to develop this they just executing the SQL.
If you need more information in executing an RFC,
please decide which option is your favorite,
and I would add information... -
Sql Commands for Backup and restore database
Hi,
What are the SQL commands used for database backup nad restore?
Is it possible to use these command in pl/sql block or it is used only
from sql plus?
Thanks
Jobin .SPhttp://download.oracle.com/docs/cd/B19306_01/backup.102/b14192/intro005.htm
-
How to do SQL Command for this
Hi,
I have 2 tables.
TempTT TempTB
Name Place DeviceName Products
Factory_55 Indonesia Factory_55##11122 Pencils
Factory_22 USA Factory_22##23444 Pens
Factory_33 UK Factory_22##82922 Erasers
How do I do my SQL command if I wanted to extract DeviceName from TempTB
if TempTT.Name is found in TempTB.DeviceName??
Please advise me. Thank you!!I do not want to join them. I show my table here again. I wanted to SELECT DeviceName from TempTB if the Name from TempTT is found in DeviceName of TempTB. Thanks alot!
TempTT
Name Place
Factory_55 Indonesia
Factory_22 USA
Factory_33 UK
TempTB
DeviceName Products
Factory_55##11122 Pencils
Factory_22##23444 Pens
Factory_22##82922 Erasers -
Help with sql command for inventory cost change report
Inventory Cost Changes within date range.
Columns on report
Item LastDateChanged CurrentCost PriorCost
Source File-TransHst (Type 14 is inventory cost change)
example data
Type,Item,DtChg,Cost
14,15825,02/01/2014,357.00
14,45832,03/15/2014,95725.00
14,15825,10/01/2013,322.00
14,45832,06/22/2012,94632.00
example output needed
Item LastDateChanged CurrentCost PriorCost
15825 02/01/2014 357.00 322.00
Using Crystal Reports 2008 with Oracle Database
I cannot create sql to retrieve data to create report.
Need Item, Last Change Date, Current Cost and Prior Cost as output of sql
ThanksHI Jerry,
I don't know real syntax of your database, try below SQL, you may have to modify the syntax wherever it is required.
Select t.Item, Max(t.DtChg),(case when year(t.dtchg) = Year(sysdate) then t.Cost else 0) as currentCost,
(case when year(t.dtchg) = Year(sysdate)-1 then t.Cost else 0) as PriorCost
From TransHst t
Where Type=14
Group by t.Item
Thanks,
Sastry -
Need PL/SQL Command for to check all rows value for child record and update
Hi All,
i want to update one field following by
one to many relationship for example
in child applet status field is value is "Closed" for all child record then parent value also should update to closed
Note: if one child record field status is "Open" don't do the update operationYou can do it in single UPDATE operation.
Here is sample & Result:
create table PA (id varchar2(3), name varchar2(12), STATUS varchar2(12));
insert into pa values('001','Cary','Open');
insert into pa values('002','TOM','Open');
create table boy (par_id varchar2(3), id varchar2(4), name varchar2(12), status varchar2(12));
insert into boy values('001','ABC1','Cary','Open');
insert into boy values('001','ABC2','Mac','Closed');
insert into boy values('001','ABC3','Ray','Closed');
insert into boy values('001','ABC4','NALLY','Open');
insert into boy values('002','ABC5','ME','Closed');
insert into boy values('002','ABC6','SHE','Closed');
UPDATE PA
SET STATUS='Closed'
WHERE NOT EXISTS
(SELECT 1
FROM BOY
WHERE BOY.PAR_ID=PA.id
GROUP BY BOY.PAR_ID,
BOY.STATUS
HAVING SUM(DECODE(BOY.STATUS,'Open',1,'Closed',0,0))>0
select * from pa;
001 Cary Open
002 TOM Closed -
MS Access SQL Command Automatic Update
Does anyone know the SQL command for automaticlly incrementing a number in Microsoft Access?
I'm writing a program in Java and I have these 3 fields of ID, name and address, and I want the ID to be automicattly incremented each time a name and address is added.If you have a table like this.
customer_table: id_column, name_column
Then you do an insert like the following
insert into customer_table(name_column) values('xxx')
After that the id_column will have a value in it. For the next insert the id_column will have a different incremented value. -
I have been forced to write some simple scripts for Windows users who use Oracle. I used to write in bash/ksh and have no experience at all about windows scripts. What I figured out is :
cmd file:
echo off
set script_dir= .
set log=%script_dir%\log\db.log
set scrsql=%script_dir%\db.sql
sqlplus /nolog @%scrsql% >> %log%
so my questions are :
- I would like to have all commands ( batch and sql) visible inside cmd file. Is it any way to put sql commands line by line into cmd file ?
- how to redirect output of sql command ( for example simple select ) to screen or file
- how to put external parameter into sql command ( for example select xx from yy where zz=@param)
KP>well, I do not see too much responses for my question - maybe it was not clear enough ?
Let me write it in this way:
I have a short ksh script:
+#!/usr/bin/ksh+
LOG_DIR=$ORACLE_HOME/dba/scripts/log
LOG=$LOG_DIR/log.txt
VAR=$2
export ORACLE_SID=$1
sqlplus -s '/as sysdba' << ! >> $LOG << call sqlplus commands inside a script
whenever sqlerror exit failure;
select * from table where columnsvalue= $VAR; << use variable in sql query
+!+
How to convert, in most easy way, such a script to windows batch. If I get an answer it solves almost all problems I have. -
FLASHBACK Database : rman vs sql command differnces
I am new to Oracle and want understand the difference and which is the correct way of flashing back the database?
RMAN command vs SQL Command on using FLASHBACK DATABASE
SQL> FLASHBACK DATABASE TO RESTORE POINT BEFORE_ONLINE_TEST; {CODE} Vs rman> run{
flashback database to restore point BEFORE_TEST_320130313;
sql "alter database open resetlogs"; }
Referring this article on http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmflash.htm#BGBDCAFA it says we can use both RMAN and SQL command for database flashback.
Questions:
1. Difference between using RMAN and SQL command on database flashback?
2. When to use RMAN or SQL on the database flashback?
3. Which is the Oracle recommended or best way ?
Edited by: Sivaprasad S on Mar 15, 2013 7:26 PM
Edited by: Sivaprasad S on Mar 15, 2013 7:26 PM
Edited by: Sivaprasad S on Mar 15, 2013 7:27 PM
Edited by: Sivaprasad S on Mar 15, 2013 7:27 PM
Edited by: Sivaprasad S on Mar 15, 2013 7:28 PM
Edited by: Sivaprasad S on Mar 15, 2013 7:29 PMWhen I issue the SQL Plus command of
SQL> flashback database to restore point BEFORE_TEST_20130313 ;
flashback database to restore point BEFORE_TEST_20130313
ERROR at line 1:
ORA-38754: FLASHBACK DATABASE not started; required redo log is not available
ORA-38762: redo logs needed for SCN 87612483975 to SCN 87612485856
ORA-38761: redo log sequence 1 in thread 1, incarnation 3 could not be accessedHowever on running this on RMAN
RMAN>
list backup of archivelog scn between 87612483975 and 87612485856
RMAN> ;
starting full resync of recovery catalog
full resync complete
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
5212758 19.75M SBT_TAPE 00:00:04 13-MAR-2013 16:36:17
BP Key: 5212765 Status: AVAILABLE Compressed: NO Tag: TAG20130313T163611
Handle: <TestDB_60:809973373:1>.al Media: 945c30b6:506c6cd2:3a14:0001
List of Archived Logs in backup set 5212758
Thrd Seq Low SCN Low Time Next SCN Next Time
1 1 87612468290 13-MAR-2013 13:28:19 87612484321 13-MAR-2013 16:36:06
1 2 87612484321 13-MAR-2013 16:36:06 87612484339 13-MAR-2013 16:36:09
BS Key Size Device Type Elapsed Time Completion Time
5212759 896.50M SBT_TAPE 00:00:17 13-MAR-2013 16:36:30
BP Key: 5212766 Status: AVAILABLE Compressed: NO Tag: TAG20130313T163611
Handle: <TestDB_59:809973373:1>.al Media: 945c30b6:506c6cbd:39f5:0001
List of Archived Logs in backup set 5212759
Thrd Seq Low SCN Low Time Next SCN Next Time
1 5 87612363812 12-MAR-2013 14:22:26 87612659040 13-MAR-2013 03:04:08
run {
allocate CHANNEL dev_2 TYPE 'SBT_TAPE' format '%U' PARMS 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8)';
allocate CHANNEL dev_3 TYPE 'SBT_TAPE' format '%U' PARMS 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8)';
allocate CHANNEL dev_4 TYPE 'SBT_TAPE' format '%U' PARMS 'SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.so,ENV=(OB2BARTYPE=Oracle8)';
flashback database to restore point BEFORE_TEST_20130313;
sql "alter database open resetlogs";
release channel dev_2;
release channel dev_3;
release channel dev_4;
starting media recovery
archived log for thread 1 with sequence 2 is already on disk as file +DG_PERF_FLASH_02/TestDB/archivelog/2013_03_14/thread_1_seq_2.3612.810054205
archived log for thread 1 with sequence 3 is already on disk as file +DG_PERF_FLASH_02/TestDB/archivelog/2013_03_14/thread_1_seq_3.1588.810054205
channel dev_2: starting archived log restore to default destination
channel dev_2: restoring archived log
archived log thread=1 sequence=1
channel dev_2: reading from backup piece <TestDB_60:809973373:1>.al
channel dev_2: piece handle=<TestDB_60:809973373:1>.al tag=TAG20130313T163611
channel dev_2: restored backup piece 1
channel dev_2: restore complete, elapsed time: 00:00:46
channel dev_2: deleting archived log(s)
archived log file name=+DG_PERF_FLASH_02/TestDB/archivelog/2013_03_15/thread_1_seq_1.2969.810106317 RECID=49 STAMP=810106318
media recovery complete, elapsed time: 00:00:05
Finished flashback at 10-MAR-2013 05:32:07
database reset to incarnation 5215723
When we issue the SQL Plus command, if there is need of old database backup of archive log, how does that SQL Plus communicate with rman recovery catalog and retrieve? -
I was wondering if any could give me templates or advice about these three things i have to write sql commands for
Create SQL queries to do the following :
1) List the names of all the staff in the electronic analysis department.
2) List all the Part-time staff working for the company.
3) Find which department has the largest annual budget and what it is.
Any help would be gratefully recievedWe could guess at things like this.
Create SQL queries to do the following :
1) List the names of all the staff in the electronic analysis department.SELECT staff_names
FROM staff
WHERE department = 'electronic analysis';
2) List all the Part-time staff working for the
company.SELECT *
FROM staff
WHERE part_time = 'Y';
3) Find which department has the largest annual
budget and what it is.SELECT *
FROM department
WHERE annual_budget = (SELECT MAX(annual_budget) FROM department);
But of course we don't know the table structures so it could vary drastically.
The thing with homework questions is that you can get someone else to do them for you, but if you don't really understand how it's working then you WILL be found out.
Maybe you are looking for
-
When I try to download anything from iTunes or the App Store on my iPod Touch, my sister's Apple ID pops up instead of mine. How can I get my iPod Touch to display my Apple ID and ask for my password rather than display my sister's Apple ID?
-
I use Time Capsule to distrubute wifi thoughout my home. I have an office laptop (windows) that my company's IT dept won't install a wireless card in (for security reasons????). Can I get an intenet connection to the laptop if I connect it to an et
-
Planning Web Form Differences with SmartView Form
We have a planning form that "hides" (hide the segment on the data form option enabled) a couple of columns. This works fine when we open the planning form via the planning web application. However, if we open the same form via Excel/SmartView the fo
-
No authorized after run CPACache refresh
Hi, I can't do cpacache refresh as follow, it always show "You are not authorized to view the requested resource.", and i have all authorize now. http://<host:port>/CPACache/refresh?mode=full
-
Is there a way to hide and unhide specific files programmatically using Labview?
I writing an application that produces 3 binary data files and I want the user to only see 1 of the 3 files. I'm using Labview 6.1 and windows 2000.