Order by on the basis of last characters of the column
hi
i have this type of data in Column
ABL - Allied Corp. services (XES) - Newyork
ABL - Allied Corp. services (XES) - Chicago
SBS - Logistics - Newyork
ETC..
As the last characters are for city and i want to perform order by on the basis of city.The naming convention is "the name always contain two hiphens(-)
and the city name in the last".(means after second '-')
Regards
SQL> INSERT INTO dt_test VALUES('ABL - Allied Corp. services (XES) - Newyork');
1 row created.
SQL> INSERT INTO dt_test VALUES('ABL - Allied Corp. services (XES) - Chicago');
1 row created.
SQL> INSERT INTO dt_test VALUES('SBS - Logistics - Newyork');
1 row created.
SQL>
SQL> select
2 column_1
3 FROM
4 dt_test
5 ORDER BY
6 SUBSTR(column_1, INSTR(column_1,'-',1,2) + 2);
COLUMN_1
ABL - Allied Corp. services (XES) - Chicago
ABL - Allied Corp. services (XES) - Newyork
SBS - Logistics - Newyork
Similar Messages
-
Swapping the first and last characters in a column
Hi,
Fairly new to T-SQL and i want to swap the first and last characters in a column.
Thanks
Umar JavedLikewise i have also tried your suggestion and i still seem to be getting errors:
IF (@TYPE = 'SCRAMBLE')
BEGIN
DECLARE @SQLCOMMAND VARCHAR(2000)
SET @SQLCOMMAND = 'UPDATE ' + @TABLENAME + ' SET ' + @VALUE +
STUFF(STUFF(@VALUE,1,1,RIGHT(@VALUE,1)),LEN(@VALUE),1,LEFT(@VALUE,1))
EXECUTE(@SQLCOMMAND)
END
Umar Javed
Please post the errors.
EDIT: Actually looking at your code this will bring errors:
IF (@TYPE = 'SCRAMBLE')
BEGIN
DECLARE @SQLCOMMAND VARCHAR(2000)
SET @SQLCOMMAND = 'UPDATE ' + @TABLENAME + ' SET ' + @VALUE + ' = STUFF(STUFF('+@VALUE+',1,1,RIGHT('+@VALUE+',1)),LEN('+@VALUE+'),1,LEFT('+@VALUE+',1))'
PRINT @SQLCOMMAND
EXECUTE(@SQLCOMMAND)
END
I've also added a print command so it will show you what the code looks like upon concatenation. It's much easier to debug this way. -
Traffic light on the basis of last month
Hi guys,
I have a question about the traffic light in the model Visual Composer. I would like to have a traffic light besids a table or graphic that wil be shown the status ( Green, red, yellow!) on the basis of the last month. In the table or in a graphic wil be shown several data of several months. But the traffic light have to respond on the basis of last month. That means that, if the last month exception( in the query) is green, the traffic light also wil be green.
Can anybody help me please?
Another question.
How can i get only two types of order as example in a pie chart? I have seen that in a pie chart you can only add one formula, not two.So!!
Thanks,
Regards,
EsratIn the VC model create an Expression Box. Double click on this box to open up its Properties.
In the control properties window there is tab "Styles", here give Green color to the column 'Style' and in the next column 'Condition' select 'Enter Formula...'
Select the field and enter the condition.
Like
Style Condition
Style 1 @CITY == 'Frankfurt'
Style2 @BANK_CTRY == 'DE' -
To fetch data on the basis of last program run date and time
Hi all,
My query is as folows:
I am selecting BOM components from STPO table on the basis of some criteria.
My requirement is to select only BOM components which are newly added or created after last program run,i.e. STPO-AEDAT and STPO-ANDAT are greater than last program run.Here i fetched last program date from customised structure(client specific) which has date field also,and compared with aedat and andat in STPO records.But how can I connect it with last run time as there is no such time field in STPO table.I need to fetch this data on the basis of last program run(time+date).
Please help me..it's crucial,
Thanks in advance,
MeenaHi,
We had a very similar requirement.
We developed a custom-solution for this.
Create a Z-Table and update it with your progname, date and time.
Whenever the BOM was changed, it generated a change number ( this has to be done by the user)
You can get the date and time from the change Number Table AENR and compare it with the timestamp in Z-TABLE
Hope it helps,
RJ -
How to show the First and Last name of the user instead of user name
Gurus,
We have the full email id of the user as the portal user name. Right now we are using the "Item Attributes - Current User" to show the user name. We don't want to show this anymore. We would like to show the First and Last name of the user on the Portal page. How can i do this. Please post a reply if you have some idea about it.
Thanks
Raj
---------I believe this is possible using the security APIs. See http://portalstudio.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/PDK/PLSQL/DOC/PLDOC_9026/INDEX.HTML and look for person_info (Returns user information, given a user name)
under wwsec_api
Suggest posting any follow-up questions to the Security forum - http://forums.oracle.com/forums/forum.jsp?forum=6 -
Changing the report displayed on the basis of value selected frm the prompt
Hi,
I have requirement in which there is dashboard prompt which has three columns namely year, month and report name.
The user will select the report name from the prompt, once done the report that has been selected should show up
on the dashboard page and he should be able to select data on the basis of month and year from it.
Also, if the user wants to go to the other report he should be able to select it from the prompt and view it.
Pls shed some light on how to progress about it. As of now think if something like this is possible then it would definitley
need two prompts one for report name and the other for month and year.
Thx :)Hi Kishore,
When i click on the link given by you it takes me to a page where a link is given with text as under
Oracle BI 10.1.3.3/2 - Selecting Reports from Dashboard Prompts and Guided Navigation Sections
And when i click on this nothing opens up.
Thx
Edited by: Phantasm on Jun 22, 2010 3:05 AM -
Need the first day of the year and last day of the year.
hi all,
i need a function module which can get me the first day of current year and last day of the current year??
please help.Similar date questions are being asked ALL THE TIME. Please search.
-
Setting up the sender communication last week of the month
Hi All,
I am doing right now JDBC to RFC, now my problem is i need to featch the data in this way "daily during the last week of the fiscal month, and first few days of the following month" i need to extract the data and send it RFC as receiver.
How can i schedule my JDBC Adaptor communication chennal..
I have checked with Availability Time Planning but i am not sure how i can do it.
Could you pls give some info how can achive this.
Thanks in advance
VenkatHi,
the problem is that you can't trigger the JDBC Sender Adapter.
There was already a similar discussion in this thread:
How to trigger XI scenario from a SQLServer Database?
Regards
Patrick
(Sorry it was a wrong link first)
Edited by: Patrick Koehnen on Jan 19, 2009 12:25 PM -
How can I access documents on a frozen Pages app? The Pages app on my IPAD does not function after the IPAD was backed up on the ICloud, and then restored. I synced the IPAD, but this did not solve the problem. Other apps are working, just not Pages. Please help! These docs are badly needed for work. Thanks so much!
Have you tried closing the Pages app completely and seeing if it works ok when you re-open it ? From the home screen (i.e. not with Pages 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Pages app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot. -
How to compare the first and last characters of strings?
lets say we have a name column with values;
c1
Antu Anamentu
Steven Smith
Since A=A and U=U for the first value we need a TRUE and FALSE for the second value SQL. Is this possible to do with REGEXP functions on 10gR2.
Thank you.Hi Frank,
Just minor correction: REGEXP_LIKE (Name1, '^(.).*(.) \1.*\2$') ;
Explanation: ^(.) =>^ specifies the next char is first char
. dot specifies single character
() defines group which can be backrferenced
.* => Any number of characters as we want only first and last character
(.) => (.)space The space signifies that we want to remember last char of first word or char before space
\1 => It recalls first group which we saved for backreference using (.)
.* => Any number of chars
\2 => It recalls first group which we saved for backreference using (.)
$ => It specifies the char before this is last charHope it clarifies :)
SQL> WITH t AS
SELECT 'Antu Anamentu' Name1 FROM DUAL UNION ALL
SELECT 'Steven Smith' Name1 FROM DUAL
SELECT Name1
FROM t
WHERE REGEXP_LIKE (Name1, '^(.).*(.) \1.*\2$') ;
NAME1
Antu Anamentu -
How we claculate the first and last date of the month
hi,
I have a requirement, if i have the any date of a month like today date 02/13/2008. So i want the first date of this month and the last date of this month.
Is there any FM for this..or if you have nay prorgam pls send to me.
thanks.Hi Vipin,
Try
HR_JP_MONTH_BEGIN_END_DATE FM will return both first day and last day
LAST_DAY_OF_MONTHS for getting last day of month.
Reward if helpful.
Regards,
Mandeep -
How long does the student plan last? (Throughout the year or just September)
II'm just wondering since I want to buy an imac for school and if I can pay the student plan without waiting for September.
You need to contact Apple directly and ask that question. This is a user to user forum and we wouldn't have any idea what Apple's plan are.
-
How to calculate last week of the month
i want calculate dollar on the basis of last week of the month.
Hi prashant,
try to filter with the required month. if this is not your question, explain little bit clear..so, that some one will help you if they have the solution with.
or do you want to create a variable and then filter prompts...
cheers...
Edited by: ManiEswar on 24-Jan-2011 12:59 -
Order by on the basis of condition
I want to make order by in sql query result with condition, if data will b numaric the it should be order by on the basis of to_number else on the basis of to_char.
Edited by: Siddharth Singh on May 17, 2012 2:24 PMKiran wrote:
decode(LOWER(trim(col1)), UPPER(trim(col1)),to_number(trim(col1)) ,trim(col1));Did you read my reply to Ankit Rathi? Again, expression can't return values of different type. But in your case it is even worth. DECODE returns datatype based on first decoded expression. Therefore your decode will return number and as a result will fail on very first non-numeric value:
SQL> with t as (
2 select '1' col1 from dual union all
3 select '2' from dual union all
4 select 'A' from dual
5 )
6 select col1
7 from t
8 order by decode(LOWER(trim(col1)), UPPER(trim(col1)),to_number(trim(col1)) ,trim(col1));
order by decode(LOWER(trim(col1)), UPPER(trim(col1)),to_number(trim(col1)) ,trim(col1))
ERROR at line 8:
ORA-01722: invalid number
SQL> But even if you would come up with decode where first decoded expression is a string your decode wuold be useless since at the end all values would be converted back to strings. If by numeric OP means strings with digits only:
ORDER BY CASE WHEN REGEXP_LIKE(col1,'^\d+$') THEN TO_NUMBER(col1) END NULLS LAST,
col1;For example:
with t as (
select '10' col1 from dual union all
select '2' from dual union all
select '1A' from dual union all
select '1B' from dual union all
select '1C' from dual
select col1
from t
ORDER BY CASE WHEN REGEXP_LIKE(col1,'^\d+$') THEN TO_NUMBER(col1) END NULLS LAST,
col1
CO
2
10
1A
1B
1C
SQL> SY. -
How to order CM25 profile on the basis of a field values?
Hi,
I'd like to order a capacity planning table on the basis of values (decreasing) of the field USR02, that is already present in the table. Where could I set that records must be shown in that order? I attach a screenshot to explain you better my scenario
Thank you.
AngeloHi Angelo,
Try to use t-code OPDT and define a sort criteria profile with field USR02, after that assign the sort profile into your list profile (With t-code OPD0). Hope it can help you!
Best regards
Tao
Maybe you are looking for
-
Workflow API: adding and accessing file Attachments to a Human Task
Hi there, I am using the Workflow Services Java API (11.1.1) for SOA Suite to access and manipulate human tasks. I would like to be able to access and add file attachments to existing human tasks. I am using the methods provided in the AttachmentType
-
When I try to import a word document, I get the message file to large and I need to copy and paste into several web pages. Then go to copy and paste and get the same message.
-
Mouse jumps around when power cord is in use not battery.
hi, i am using a 3rd party cord, apple says to use an apple cord. i dont like them because they are to short and to expensive. plus my dad has a ibook g4 with the apple cord and it does the same thing on mine.
-
Weird question about GNOME3 and its new search function
Ok, it may sound a little strange and I fear for your answers but here is the question... Is there any way to make gnome3 not to search for ABSOLUTELY EVERYTHING when "typing to search" in the menu? I mean, for god's sake, I was testing all the menus
-
Plots start at zero in plot legend
I have a graph that plots measurements from 14 different sensors. However, the graph legend starts numbering the plots at zero. I would like this to start at 1 rather than zero, but cannot find an option for this. This should be simple, so perhaps I