SQL query - how to get parameters into a function within a SELECT statement
Hi,
I have SQL query roughly as follows
SELECT A, B, C, MAX(CASE...) AS "D_NAME", FunctionX(B, C, "D_NAME")
FROM...
WHERE...
How to get alias "D_NAME" as a valid parameter into FunctionX?
Hi,
user8819407 wrote:
Hi,
I have SQL query roughly as follows
SELECT A, B, C, MAX(CASE...) AS "D_NAME", FunctionX(B, C, "D_NAME")
FROM...
WHERE...
How to get alias "D_NAME" as a valid parameter into FunctionX?Either
(1) repeat the calculation or
(2) compute it in a sub-query
Here's an example of (2)
WITH got_d_name AS
SELECT A, B, C, MAX(CASE...) AS "D_NAME"
FROM...
WHERE...
SELECT A, B, C, D_NAME, FunctionX (B, C, D_NAME)
FROM got_d_name
;A column alias (like d_name) can be referenced in the ORDER BY clause of the query where it was defined, but that's the only place in that query where it can be referenced.
Similar Messages
-
How to get around Ampersand in text field in Select statement
I have an SQL statement I am trying to run in SQL*Plus. In one of my subqueries, I have a select statment in which some of the fields I am trying to pull have an "&" within the text. So, when I try and run the query it returns "Enter value for 35:". I've even tried wildcard characters and it is still not working. If anyone could help me with this, I would appreciate it. Here is a sample of my statement (the subquery is at the bottom of the statement):
select real_case.file_dt, real_case.dscr, pty_cd, first_name, last_name, addr_line1, addr_line2, city, st_cd, zip_cd
from real_case, pty, idnt, ptyaddr s1, addr
where real_case.case_id = pty.case_id
AND pty.idnt_id = idnt.idnt_id
AND pty.case_id = s1.case_id
and pty.seq = s1.seq
and s1.addr_id = addr.addr_id
and (real_case.file_dt >= '01-NOV-06'
and real_case.file_dt <= current_date)
and (real_case.dscr like '79D01-%'
or real_case.dscr like '79C01-%'
or real_case.dscr like '79D02-%')
and (pty.pty_cd like 'DFNDT')
and (s1.ins_dttm in
(select max(s2.ins_dttm) from ptyaddr s2
where s2.case_id = s1.case_id
and s2.seq = s1.seq))
and (real_case.case_id in
(select case_id from ptychrg
where ptychrg.actn_cd IN ('35-41-5-1&35-48-4-1')));Thanks,
Shannonthis?
SQL> set define off
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (select 'a&b' col from dual
3 union all
4 select 'abc' from dual)
5 select * from t
6* where col like '%\&%'
7 /
COL
a&b
or this
SQL> ed
Wrote file afiedt.buf
1 with t as
2 (select 'a&b' col from dual
3 union all
4 select 'abc' from dual)
5 select * from t
6* where col like '%'||chr(38)||'%'
SQL> /
COL
a&bjust '%'||chr(38)||'%' will not work.
You nedd either set scan off or set define off
correction
Message was edited by:
devmiral -
How to get all values from an interval using select statement
Hi,
Is it possible to write a select statement that returns all values from an interval? Interval boundaries are variable.
something like this:
select (for x in 1,1024 loop x end loop) from dual
(this, of course, doesn't work)
The result in this example should be 1024 rows of numbers from 1 to 1024. These numbers are parameters, so it is not possible to create a table with predefined values.
Thanks in advance for your help,
Mia.For your simple case, with a lower boundary of 1, you can use:
SELECT rownum
FROM all_objects
WHERE rownum <= 1024For a set of number between say 50 - 100, you can use something like:
SELECT rownum + (50 - 1)
FROM all_objects
WHERE rownum <= (100 - 50 + 1)Note, that all_objects was used only because it generally has a lot of rows. Any table with at least the number of rows in your range will work.
TTFN
John -
Sql loader, how to get decimals into the database?
oracle 10.2
we have data of the form
1.10
1.11
we are using "decimal external" in the control file.
The table is a straight number field
I did a test where I created a table with a number field and without and precision and did regular inserts. I got the decimal values.
so I did
create table x (y number);
insert into x values (1.10);
insert into x values (1.11);
and i got back
1.1
1.11
when we sql load we get
1
1Why use decimal external then? What's wrong with leaving the field as number?
-
How to get the sum in BSEG table using select statement
hai all
i made the internal tale "itab1" .. i want to get the som feild of DMBTR in BSG table my code is here but its not working gave som error massage (Aggregate functions and the addition DISTINCT are not supported in field lists for pooled and cluster tables.) plz tel me how should i do it..... i want to get the som of that feild....
loop at itab1
SELECT sum( DMBTR ) from bseg INTO itab1-DMBTR141_45
where GJAHR = itab1-GJAHR
and BELNR = itab1-BELNR.
endloop.
regard
nawaSELECT BELNR GJAHR SHKZG DMBTR
from bseg
INTO table it_bseg
for all entries in itab1
where GJAHR = itab1-GJAHR
and BELNR = itab1-BELNR.
loop at it_bseg.
IF it_bseg-shkzg = 'H'.
it_bseg-dmbtr = it_bseg-dmbtr * ( -1 ).
ELSE.
it_bseg-dmbtr = it_bseg-dmbtr.
ENDIF.
MODIFY it_bseg.
endloop.
loop at it_bseg.
READ TABLE itab1 with key belnr = it_bseg-belnr
gjahr = it_bseg-gjahr.
if sy-subrc = 0.
collect it_bseg into it_bseg_amount.
endif.
endloop.
U can use the collect statement
Regards
Gopi -
How to get audio into Adobe Premiere Elements 12?
How to get audio into Adobe Premiere Elements 12?
I have filmed an air show with a very good camera JVC pro
And when I pick up the clips in Adobe Premiere Elements 12, it works too, but only without sound.
I think I tried everything for 4 days now.
Sound in my computer works perfectly
I go to where the video files are located and try to run them in VLC or in Nero Kwik so it works fine with both audio and video.
I have checked the sound card.
Yes, I have tried everything so now I'm so tired of this lousy so I'm ready to throw this program at the dump.
It's not normal if you will keep on producing audio for over 4 days at Adobe
The old Elements 9 worked fine. Offer some of would consider developing it again. I do not know how I should do.
My name is Thore Hult
live in Karlshamn in SwedenThore Hult
On what computer operating system is your Premiere Elements 12 working on? Have you updated it from 12 to 12.1 Update using an opened project's Help Menu/Update. If not, please do so.
For your immediate problem.
What is the model/settings for the JVC camera that recorded you video. I want to get at the properties of your source video including the file extension.
Since you are getting video, but no audio, please download and install the free codec utility named GSpot to see what is shows
for your Audio Name and Status.
http://www.headbands.com/gspot/
The other properties of the file there would also be of interest.
When you import your source file into the project, do you see any "conforming" activity going in a progress bar at the bottom right corner of the workspace?
If so, do you wait for it to complete before you move forward in the project?
Can you get sound in any of your Premiere Elements projects with this current JVC file or other?
Can we assume that your troubleshooting has included checking
a. Volume control within the project
b. Edit Menu/Preferences/Audio Hardware ASIO
Let us start here and then we can decide what next if necessary.
Thanks.
ATR -
I have Maveriks. I downloaded numerous ACID Fonts and purchased Stuffit as instructed by ACID Fonts in order to use them. However, now I am unable to figure out how to get them into my Font Family drop down list or insert into Pages. PLS HELP!
Hi FancyJean!
Here is an article for you about using Font Book and installing fonts that you have downloaded:
Mac Basics: Font Book
http://support.apple.com/kb/ht2509
Thanks for being a part of the Apple Support Communities!
Cheers,
Braden -
Anyone know how to get subtitles into Quicktime movies?
With Quicktime now supporting subtitles. Does anyone know how import subtitles into Quicktime movies?
After following the instructions from Apple's support pages for timed text, I tried pasting in timed text. This displays text below the video in an ugly black bar, but isn't recognised as subtitles by Quicktime. Ideally, I'd like to convert srt files into a compliant format, but without knowing the correct format, it's a little difficult.There haven't been any really clear instructions on how to get subtitles into QuickTime movies yet. Apple has posted a QuickTime component that will convert an SCC file into QuickTime and you'll find that here.
http://developer.apple.com/samplecode/ClosedCaptionImporter/index.html
Also, a discussions user has posted instructions on how to CC a QuickTime movie in this thread.
http://discussions.apple.com/thread.jspa?messageID=5756610�
And here's another thread you may find helpful links in.
http://discussions.apple.com/thread.jspa?messageID=5720947� -
I'm trying to make a holiday card, but can't figure out how to get photos into the card.
Selectto( s) and create the card - if you want to add more photos ot it drag then to the card project in the source pane on the left
LN -
Hierarchical query - How to get all parent records - Duplicate post
Hi,
In Oracle, START WITH, CONNECT BY commands will give all the direct and indirect child records. Other way round, is they are command which gives all the parent records till the root? Please let me know. I am working on Oracle 9i Release 2.
Thanks a lot for your help.
Edited by: skv on Nov 21, 2008 11:05 AMDuplicate post.
Hierarchical query - How to get all parent records
Please edit this post heading to duplicate post.
Regards.
Satyaki De. -
How to get text into a timeline
I do not understand how to get text into a timeline in Premiere Pro. I can work in titles more or less, change fonts and sizes, but I do not get how to insert the text into the timeline. Am I even starting at the right place, going into "titles" first?
Once you have made your title, drag it from the project panel to V2 on your timeline above your other footage.
-
How to get tabs into a column on left edge of Firefox window?
How to get tabs into a column on left edge of Firefox window?
I've looked extensively for the answer but haven't found it yet.I found the Tree Style Tab ad-on does this.
Mike -
Hello friends,
I am displaying values ie, amounts in the screen using write statements here i have to display the
sign left side , i am using Function module 'CLOI_PUT_SIGN_IN_FRONT'
Does anybody help me - How to pass paramter into this Function module.
Regards,
PhaneendraIf you look to the code of the function module, you can see it is condensing the value.
I would make a copy of this function, and remove the condense lines to give the result you want.
data: text1(1) type c.
search value for '-'.
if sy-subrc = 0 and sy-fdpos <> 0.
split value at '-' into value text1.
condense value.
concatenate '-' value into value.
else.
condense value.
endif. -
How to join THREE different tables into internal table using one select statement .
How to join THREE different tables into internal table using one select statement .
Hi experts,
I would like to request your guidance in solving the problem of joining the data from three different database tables into one internal table
Scenario:
Database tables:
SPFLI
SFLIGHT
SBOOK.
Table Fields:
SPFLI - CARRID CONNID COUNTRYFR CITYFRM COUNTRYTO CITYTO
SFLIGHT - CARRID CONNID FLDATE SEATSMAX SEATSOCC SEATSMAX_C
SEATSOCC_C SEATSMAX_F SEATSOCC_F
SBOOK - CARRID CONNID CLASS
MY INTERNAL TABLE IS IT_XX.
Your help much appreciated.
Thanks in advance.
Pawan.Hi Pawan,
please check below codes. hope it can help you.
TYPES: BEGIN OF ty_xx,
carrid TYPE spfli-carrid ,
connid TYPE spfli-connid ,
countryfr TYPE spfli-countryfr,
cityfrom TYPE spfli-cityfrom ,
countryto TYPE spfli-countryto,
cityto TYPE spfli-cityto ,
fldate TYPE sflight-fldate ,
seatsmax TYPE sflight-seatsmax ,
seatsocc TYPE sflight-seatsocc ,
seatsmax_b TYPE sflight-seatsmax_b,
seatsocc_b TYPE sflight-seatsocc_b,
seatsmax_f TYPE sflight-seatsmax_f,
seatsocc_f TYPE sflight-seatsocc_f,
class TYPE sbook-class,
END OF ty_xx,
t_xx TYPE STANDARD TABLE OF ty_xx.
DATA: it_xx TYPE t_xx.
SELECT spfli~carrid
spfli~connid
spfli~countryfr
spfli~cityfrom
spfli~countryto
spfli~cityto
sflight~fldate
sflight~seatsmax
sflight~seatsocc
sflight~seatsmax_b
sflight~seatsocc_b
sflight~seatsmax_f
sflight~seatsocc_f
sbook~class
INTO TABLE it_xx
FROM spfli INNER JOIN sflight
ON spfli~carrid = sflight~carrid
AND spfli~connid = sflight~connid
INNER JOIN sbook
ON spfli~carrid = sbook~carrid
AND spfli~connid = sbook~connid.
Thanks,
Yawa -
How to find the number of fetched lines from select statement
Hi Experts,
Can you tell me how to find the number of fetched lines from select statements..
and one more thing is can you tell me how to check the written select statement or written statement is correct or not????
Thanks in advance
santoshHi,
Look for the system field SY_TABIX. That will contain the number of records which have been put into an internal table through a select statement.
For ex:
data: itab type mara occurs 0 with header line.
Select * from mara into table itab.
Write: Sy-tabix.
This will give you the number of entries that has been selected.
I am not sure what you mean by the second question. If you can let me know what you need then we might have a solution.
Hope this helps,
Sudhi
Message was edited by:
Sudhindra Chandrashekar
Maybe you are looking for
-
ITunes to iPhone... Playlists only? Am I missing something?
I haven't had my iPhone for -too- long yet but am just getting into putting music on it... it seems the only way to get music to the iPhone is to sync with a Playlist.... ?!? Is this right? I would think I could drag an album, but that doesn't seem t
-
Q: Extract additional business partner of sales order
Hi experts, In ECC we have an additional business partner on sales orders, does anyone know the best way to extract this data to BW? As far as I can find you have to customiz the LIS extractor in ECC in order to get this data. Any suggestions? Thank
-
Windows server 2012 RDP Session - Default Start Menu Layout Downloaded Apps Not Displayed
Hi, Hopefully someone can help me to resolve a problem that's holding me back a little regarding the start menu for all users that connect to remote desktop sessions on Windows Server 2012. I would like all users to have the same default application
-
MB1B 343 and PCN confirmation (TO is placing in different bin)
Hi Gurus, I received stock with migo but directly to blocked stock, it went to 902 and after that I transfered it to storage type 001, each material went into a different bin according to the putaway strategy, everything is good so far, then try to c
-
last week i purchased Apple TV but , when i am trying to loging by the apple id is giving me error "your password is not correct" but when i try to login in my Pc is working fine