How to ignore zero in select query
select * from EINA where EINAMATNR = <b>yyyy</b> and EINALIFNR = <b>zzzz</b>
In select query, how to ignore zero? for example, EINAMATNR = 0000000yyyy, EINALIFNR=000zzz
Maybe I can use LIKE keyword in sql query. Any other way?
Thanks.
Use the following conversion routines to convert yyyy & zzzz to remove the leading zeros and then pass it to your select query.
For Matnr -> CONVERSION_EXIT_MATN1_INPUT
For LIFNR ->CONVERSION_EXIT_alpha_input.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = yyyy
IMPORTING
output = t_lifnr.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = zzzz
IMPORTING
output = t_matnr.
select * from EINA where EINA~MATNR = t_matnr and EINA~LIFNR = t_lifnr .
Similar Messages
-
How to get result of select query from oracle in VC
Dear All ,
I have a application in oracle which insert the data in the oracle database table.
Now i want to show all the data that has been inserted into the database table in my VC application but i don't know how to handle select query in VC.
Regards
KrishanHi Goivndu
Thanks for your reply .
I know all those things.
I have created the system & alias for my backend oracle system.
I can also see all the stored procedure that are there in my oracle system.
I just want to know how to write a select query in a stored procedure .
you can insert data , Update data through oracle procedure but i don't think there is any way to get the result of select query in stored procedure .
If you know any way to do that please do let me know .
Regards
Krishan -
How to use offset in select query
Suppose i have data like ssonje 00000001 as a one field in database table . i have to segregate this two data. how should I do this.the first part is of 12 characters and the last is of 10 character long.
Hi Naveen,
I am again in trouble, Now the requirement were changed. I am sending you the code which i had implemented.
Now, the user enter username(ie UNAMED) and document id (ie. TEMPD) and the output should be doucment id, which has been search through database table RFDT , field SRTFD, this field contains both the username and the document id.
That means: suppose user enters UNAMED as SSONJE and TEMPD as 0000000030, then i want to fier the select query from RFDT on field SRTFD and get only the document id of that user which user enter on input field-UNAMED.
i had tried but result were not coming.
please go through the code.
data:uname type UF05A-UNAMD.
data:temp type UF05A-TEMPD.
TYPES: BEGIN OF TEITAB_RFDT,
SRTFD TYPE RFDT-SRTFD,
END OF TEITAB_RFDT.
DATA: ITAB_RFDT TYPE TABLE OF TEITAB_RFDT.
DATA: WA_RFDT TYPE TEITAB_RFDT.
DATA: STR(22) TYPE c.
SELECT-OPTIONS:UNAMED FOR uname,
TEMPD FOR TEMP.
UNAMED-option = 'CP'.
append UNAMED.
CONCATENATE UNAMED TEMPD INTO STR.
SELECT SRTFD FROM RFDT INTO CORRESPONDING FIELDS OF TABLE ITAB_RFDT WHERE SRTFD eq str.
LOOP AT ITAB_RFDT INTO WA_RFDT.
SPLIT WA_RFDT AT SPACE INTO STR1 STR2.
WRITE: / STR1,STR2.
ENDLOOP.
Please mentioned what is the way to do this.
Thanks -
How to put loop in select query..?
Hi All,
I am setting select query which CRecordSet is going to execute.
Existing query is,
Select branchNumber,Count(*) from branches where branchNumber = %d and dowloadType >%d;
Here %d is getting filled every time with new value. Now this query is getting execute 500 times if 500 branches are there.
We want to improve performance. and want branchnumber and count(*) in One go.
something like,
select branchNumber,Count(*) from Branches where
(branch =1 and dowloadType >2)
(branch =2 and dowloadType >100)
(branch =3 and dowloadType >234)
how can we do that?
Kindly help me on this.
Thanks,
Sachin.Thanks For reply. but here values are coming from different collection from source code.
For e.g. Map[branchNumber][DownloadType] = [1,233],[2,444],[30,234],[5,456].
Now these values i need to insert at the place of S.branch and S.DownloadType
SELECT GB.Branch ,
COUNT(*)
FROM @Sample S
INNER JOIN @GroupBy GB ON GB.Branch = (value from map)
AND GB.DownloadType < (value from map)
GROUP BY GB.Branch; -
How to mention index in select query?
Hi All,
If I am using fields of two diffrent secondary index in a single select query on a table how I can mention that data should be picked according to first index used in the query?
Regards
DeepakPlease search before asking basic questions.
Thread locked.
Rob -
How to get fieldnames from Select * query ?
How can I get the fieldnames returned with a SELECT * query ?
When I use GetFieldName or GetFieldOriginalName I only get fieldnames of "*".You should use the fields collection, in the OraDynaset object.
All you need to do is :
for i = 0 to Recordset.Fields.Count -1
debug.print Recordset.Fields(i).name
debug.print Recordset.Fields(i).OriginalName 'this will print the field's name before an alias
next i -
How to include conditions in select query
i want to write a select query wherein plants have to to be fetched from table vekp
and if it is a plant then the set movement type to 999 else leave for exiting.please help me on this>
deep shikha wrote:
> (This is module pool programming)
what is modulepool programming doing in form printing forum.
Please use appropriate forum next time.
кu03B1ятu03B9к -
How can we split a select query to 3 or 4 if it is fetching much records?
I am running a query like:
select * from table_name
it will be fetching 152940696 records. Now i want to fetch this result as 3 or 4 select statements. That is, in the second query I want to fetch the records from where i stopped in the first query. and similar for the 3rd i have to continue from the 2nd query. And for the 4th query i have to start from where i have stopped in the 3rd query.
when i tried with rownum we can fetch the records upto < or <= to a particular count like 100000000. But above this count i cannot fetch using rownum. Because > or >= wont work with rownum.
Is there anyother way to split the select query as i explained.
Thanks in advanceI'll assume you want to split the query up for performance reasons.
The easiest way to do this if you have the license is to use the parallel query option, which can help, hurt or do nothing. The only way to find out is to try. PQO would be best from a performance standpoint if possible, provided it will do what you need.
Failing that as has been suggested you need a logical, scalable way to divide up the queries. It has already been pointed out that the rownum solution probably will not work correctly. Also, the MINUS with ROWNUM idea has the disadvantage of having to read a lot of the same data twice, making the query run longer.
Perhaps a range would provide a way to split up the data - something like
select whatever
from table
where primary_key < 10000000;
select whatever
from table
where primary key between 10000001 and 199999999;
... -
How to do outer join select query for an APEX report
Hello everyone,
I am Ann.
I have one select statement that calculate the statistics for one month(October 2012 in this example)
select ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE('Oct 2012','MON YYYY'))
THEN last_day(TO_DATE('Oct 2012','MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
from phase_membership ph
inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
inner join defendant def on ce.defendant_id = def.def_id
where def.active = 1
and ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY'))
and ph.active = 1
and UPPER(ce.court_name) LIKE '%'
group by rollup(phase_number)
Result is as below
Phase_Number AVG_DAYS
Phase One 8.6666666666666667
Phase Two 14.6
Phase Three 12
11.4615365
I have other select list mainly list the months between two date value.
select to_char(which_month, 'MON YYYY') as display_month
from (
select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
from all_objects
where
rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
order by which_month )
Query result is as below
DISPLAY_MONTH
AUG 2012
SEP 2012
OCT 2012
Is there any way that I can join these two select statement above to generate a result like:
Month Phase Number Avg days
Aug 2012 Phase One 8.666
Sep 2012 Phase One 7.66
Oct 2012 Phase One 5.66
Aug 2012 Phase Two 8.666
Sep 2012 Phase Two 7.66
Oct 2012 Phase Two 5.66
Aug 2012 Phase Three 8.666
Sep 2012 Phase Three 7.66
Oct 2012 Phase Three 5.66
Or
Month Phase Number Avg days
Aug 2012 Phase One 8.666
Aug 2012 Phase Two 7.66
Aug 2012 Phase Three 5.66
Sep 2012 Phase One 8.666
Sep 2012 Phase Two 7.66
Sep 2012 Phase Three 5.66
Oct 2012 Phase One 8.666
Oct 2012 Phase Two 7.66
Oct 2012 Phase Three 5.66
And it can be order by either Phase Number or Month.
My other colleague suggest I should use an left outer join but after trying so many ways, I am still stuck.
One of the select I tried is
select a.display_month,b.* from (
select to_char(which_month, 'MON YYYY') as display_month
from (
select add_months(to_date('Aug 2012','MON YYYY'), rownum-1) which_month
from all_objects
where
rownum <= months_between(to_date('Oct 2012','MON YYYY'), add_months(to_date('Aug 2012','MON YYYY'), -1))
order by which_month )) a left outer join
( select to_char(ph.date_finished,'MON YYYY') as join_month, ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(a.display_month,'MON YYYY'))
THEN last_day(TO_DATE(a.display_month,'MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
from phase_membership ph
inner join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
inner join defendant def on ce.defendant_id = def.def_id
where def.active = 1
and ph.date_started <= last_day(TO_DATE(a.display_month,'MON YYYY'))
and ph.active = 1
and UPPER(ce.court_name) LIKE '%'
group by to_char(ph.date_finished,'MON YYYY') , rollup(phase_number)) b
on a.display_month = b.join_month
but then I get an error
SQL Error: ORA-00904: "A"."DISPLAY_MONTH": invalid identifier
I need to display a report on APEX with option for people to download at least CSV format.
I already have 1 inteactive report in the page, so don’t think can add another interactive report without using the iframe trick.
If any of you have any ideas, please help.
Thanks a lot.
AnnFirst of all, a huge thanks for following this Frank.
I have just started working here, I think the Oracle version is 11g, but not sure.
To run Oracle APEX version 4, I think they must have at least 10g R2.
This report is a bit challenging for me.I has never worked with PARTITION before.
About the select query you suggested, I run , and it seems working fine, but if I try this,
it return error ORA-01843: not a valid month
DEFINE startmonth = "Aug 2012";
DEFINE endmonth = "Oct 2012";
WITH all_months AS
select add_months(to_date('&startmonth','MON YYYY'), rownum-1) AS which_month
, add_months(to_date('&startmonth','MON YYYY'), rownum ) AS next_month
from all_objects
where
rownum <= months_between(to_date('&endmonth','MON YYYY'), add_months(to_date('&startmonth','MON YYYY'), -1))
select TO_CHAR (am.which_month, 'Mon YYYY') AS month
, ph.phase_number
, sum ( (case
WHEN ph.date_finished IS NULL OR ph.date_finished > last_day(TO_DATE(am.which_month,'MON YYYY'))
THEN last_day(TO_DATE(am.which_month,'MON YYYY'))
ELSE ph.date_finished
END )
- ph.date_started + 1) / count(def.def_id) as avg_days
FROM all_months am
LEFT OUTER JOIN phase_membership ph PARTITION BY (ph.phase_number)
ON am.which_month <= ph.date_started
AND am.next_month > ph.date_started
AND ph.date_started <= last_day(TO_DATE(am.which_month,'MON YYYY')) -- May not be needed
AND ph.active = 1
LEFT OUTER join court_engagement ce on ph.mpm_eng_id = ce.engagement_id
and ce.court_name IS NOT NULL -- or something involving LIKE
LEFT OUTER join defendant def on ce.defendant_id = def.def_id
AND def.active = 1
group by rollup(phase_number, am.which_month)
ORDER BY am.which_month
, ph.phase_number
;Here is the shorted versions of the three tables:
A_DEFENDANT, A_ENGAGEMENT, A_PHASE_MEMBERSHIP
CREATE TABLE "A_DEFENDANT"
"DEF_ID" NUMBER NOT NULL ENABLE,
"FIRST_NAME" VARCHAR2(50 BYTE),
"SURNAME" VARCHAR2(20 BYTE) NOT NULL ENABLE,
"DOB" DATE NOT NULL ENABLE,
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_DEFENDANT_PK" PRIMARY KEY ("DEF_ID"))
Sample Data
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (101,'Joe','Bloggs',to_date('12/12/99','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (102,'John','Smith',to_date('20/05/00','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (103,'Jane','Black',to_date('15/02/98','DD/MM/RR'),1);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (104,'Minnie','Mouse',to_date('13/12/88','DD/MM/RR'),0);
Insert into A_DEFENDANT (DEF_ID,FIRST_NAME,SURNAME,DOB,ACTIVE) values (105,'Daisy','Duck',to_date('05/08/00','DD/MM/RR'),1);
CREATE TABLE "A_ENGAGEMENT"
"ENGAGEMENT_ID" NUMBER NOT NULL ENABLE,
"COURT_NAME" VARCHAR2(50 BYTE) NOT NULL ENABLE,
"DATE_REFERRED" DATE,
"DETERMINATION_HEARING_DATE" DATE,
"DATE_JOINED_COURT" DATE,
"DATE_TREATMENT_STARTED" DATE,
"DATE_TERMINATED" DATE,
"TERMINATION_TYPE" VARCHAR2(50 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
"DEFENDANT_ID" NUMBER,
CONSTRAINT "A_ENGAGEMENT_PK" PRIMARY KEY ("ENGAGEMENT_ID"))
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (1,'AA',to_date('12/08/12','DD/MM/RR'),null,to_date('12/08/12','DD/MM/RR'),null,null,null,1,101);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (2,'BB',to_date('01/09/12','DD/MM/RR'),null,to_date('02/09/12','DD/MM/RR'),null,null,null,1,102);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (3,'AA',to_date('02/09/12','DD/MM/RR'),null,to_date('15/09/12','DD/MM/RR'),null,null,null,1,103);
Insert into A_ENGAGEMENT (ENGAGEMENT_ID,COURT_NAME,DATE_REFERRED,DETERMINATION_HEARING_DATE,DATE_JOINED_COURT,DATE_TREATMENT_STARTED,DATE_TERMINATED,TERMINATION_TYPE,ACTIVE,DEFENDANT_ID) values (4,'BB',to_date('01/10/12','DD/MM/RR'),null,to_date('02/10/12','DD/MM/RR'),null,null,null,1,105);
CREATE TABLE "A_PHASE_MEMBERSHIP"
"MPM_ID" NUMBER NOT NULL ENABLE,
"MPM_ENG_ID" NUMBER NOT NULL ENABLE,
"PHASE_NUMBER" VARCHAR2(50 BYTE),
"DATE_STARTED" DATE NOT NULL ENABLE,
"DATE_FINISHED" DATE,
"NOTES" VARCHAR2(2000 BYTE),
"ACTIVE" NUMBER(2,0) DEFAULT 1 NOT NULL ENABLE,
CONSTRAINT "A_PHASE_MEMBERSHIP_PK" PRIMARY KEY ("MPM_ID"))
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (1,1,'PHASE ONE',to_date('15/09/12','DD/MM/RR'),to_date('20/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (2,1,'PHASE TWO',to_date('21/09/12','DD/MM/RR'),to_date('29/09/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (3,2,'PHASE ONE',to_date('12/09/12','DD/MM/RR'),null,null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (4,3,'PHASE ONE',to_date('20/09/12','DD/MM/RR'),to_date('01/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (5,3,'PHASE TWO',to_date('02/10/12','DD/MM/RR'),to_date('15/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (6,4,'PHASE ONE',to_date('03/10/12','DD/MM/RR'),to_date('10/10/12','DD/MM/RR'),null,1);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (7,3,'PHASE THREE',to_date('17/10/12','DD/MM/RR'),null,null,0);
Insert into A_PHASE_MEMBERSHIP (MPM_ID,MPM_ENG_ID,PHASE_NUMBER,DATE_STARTED,DATE_FINISHED,NOTES,ACTIVE) values (8,1,'PHASE THREE',to_date('30/09/12','DD/MM/RR'),to_date('16/10/12','DD/MM/RR'),null,1);
The requirements are:
The user must be able to request the extract for one or more calendar months, e.g.
May 2013
May 2013 – Sep 2013.
The file must contain a separate row for each calendar month in the requested range. Each row must contain the statistics computed for that calendar month.
The file must also include a row of totals.
The user must be able to request the extract for either Waitakere or Auckland or Consolidated (both courts’ statistics accumulated).
Then the part that I am stuck is
For each monitoring phase:
Phase name (e.g. “Phase One”)
Avg_time_in_phase_all_particip
for each phase name,
Add up days in each “phase name” Monitoring Phase, calculated as:
If Monitoring Phase.Date Finished is NULL or > month end date,
+(*Month end date* Minus Monitoring Phase.Date Started Plus 1)+
Otherwise (phase is complete)
+(Monitoring Phase.Date Finished Minus Monitoring Phase.Date Started Plus 1.)+
Divide by the numbers of all participants who have engaged in “phase name”.
This is the words of the Business Analyst,
I try to do as required but still struggle to identify end_month for the above formula to display for the range of months.
Of course, I can write two nested cursor. The first one run the list of month, then for each month, run the parameterised report.
But I prefer if possible just use SQL statements, or at least a PL/SQL but return a query.
With this way, I can create an APEX report, and use their CSV Extract function.
Yes, you are right, court_name is one of the selection parameters.
And the statistics is not exactly for one month. It is kind of trying to identify all phases that are running through the specified month (even phase.date_started is before the month start).
This is the reason why I put the condition AND ph.date_started <= last_day(TO_DATE('Oct 2012','MON YYYY')) (otherwise I get negative avg_days)
User can choose either one court "AA" or "BB" or combined which is all figures.
Sorry for bombarding you a lot of information.
Thanks a lot, again.
Edited by: Ann586341 on Oct 29, 2012 9:57 PM
Edited by: Ann586341 on Oct 29, 2012 9:59 PM -
How to improve performance of select query when primary key is not referred
Hi,
There is a select query where we are unable to refrence primary key of the tables:
Since, the the below code is refrensing to vgbel and vgpos fields instead of vbeln and posnr..... the performance is very slow.
select vbeln posnr into (wa-vbeln1, wa-posnr1)
from lips
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endselect.
Please le t me know if you have some tips..hi,
I hope you are using the select statement inside a loop ...endloop get that outside to improve the performance ..
if not i_vbap[] is initial.
select vbeln posnr into table it_lips
from lips
for all entries in i_vbap
where ( pstyv ne 'ZBAT'
and pstyv ne 'ZNLN' )
and vgbel = i_vbap-vbeln
and vgpos = i_vbap-posnr.
endif. -
How to improve on insert-select query performance
Hi,
Would like to get some opinion on how to improve this query inside my stored proc.
This insert stmt has run more than 4 hours for inserting around 62k records.
I have identified the bottleneck is in the function within the select stmt.
Could anyone help to finetune?
INSERT INTO STG_PRICE_OUT
( ONPN,
EFFECTIVE_DT,
PRICE_CATENAME,
QUEUE_ID
SELECT P.ONPN, P.EFFECTIVE_DT,
gps_get_catename(P.PART_STATUS ,P.PROGRAM_CD ,P.MARKET_CD),
'1'
FROM PRICE P,
GPS_INV_ITEMS GII
WHERE P.ONPN = GII.ONPN
FUNCTION Gps_Get_Catename
p_status VARCHAR2,
p_pgm VARCHAR2,
p_market VARCHAR2
RETURN VARCHAR2
IS
catename VARCHAR2(30);
BEGIN
SELECT PRICE_CATENAME
INTO catename
FROM PRICE_CATEGORY PC
WHERE NVL(PC.PART_STATUS,' ')= NVL(p_status,' ')
AND NVL(PC.PROGRAM_CD,' ') = NVL(p_pgm,' ')
AND NVL(PC.MARKET_CD,' ') = NVL(p_market,' ')
RETURN catename;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
RETURN NULL;
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE('gps_get_catename: Exception caught!! (' || SQLCODE || ') : ' || SQLERRM);
RETURN catename;
END;
STG_PRICE_OUT has around 1 mil records
GPS_INV_ITEMS has around 140K records
PRICE has around 60k records
INDEX:
STG_PRICE_OUT - INDEX 1(ONPN), INDEX2(ONPN,QUEUE_ID)
GPS_INV_ITEMS - INDEX 3(ONPN)
PRICE - INDEX 4(ONPN)
PRICE_CATEGORY - INDEX 5(PART_STATUS ,PROGRAM_CD ,MARKET_CD)
Thanks and regards,
WHOnly use PL/SQL when you can't do it all in SQL...
INSERT INTO STG_PRICE_OUT
( ONPN,
EFFECTIVE_DT,
PRICE_CATENAME,
QUEUE_ID
SELECT P.ONPN, P.EFFECTIVE_DT,
PC.PRICE_CATENAME,
'1'
FROM PRICE_CATEGORY PC, PRICE P,
GPS_INV_ITEMS GII
WHERE P.ONPN = GII.ONPN
AND PC.PART_STATUS(+) = P.PART_STATUS
AND PC.PROGRAM_CD(+) = P.PROGRAM_CD
AND PC.MARKET_CD(+) = P.MARKET_CD
/Cheers, APC
P.S. You may need to tweak the outer joins - I'm not quite sure what your business rule is. -
How to write XSJS Select Query with input parameters
Hello Experts,
I am creating a xsjs file and in that file I am trying to write a Select Query based on a Calculation View
I have tried it the following way:
var query = 'SELECT TOP 100 \"Name\", \"Address\", \"City\", \"Country\" FROM \"_SYS_BIC\".\"Test.HL/AddressView\"'
+ 'WITH PARAMETERS(\'PLACEHOLDER\' = (\'$$P_Name$$\', \' Akhil \'),'
+ '\'PLACEHOLDER\' = (\'$$P_City$$\', \' Lucknow \'))';
But it gives me the "Mixed spaces and tabs error".
How should I write XSJS Select Query with input parameters?
Regards,
Rohit>But it gives me the "Mixed spaces and tabs error".
Mixed spaces and tabs has nothing to do with the syntax of the statement. You used both spaces and the tab in the content - which JSLint doesn't like. Remove the beginning spaces of each line and use only one or the other.
The actual syntax of your statement doesn't look right. The problem is that you are escaping the \ when you don't need to if you are using ' instead of " for your string. You escape with \" in the first line but then escape with \' in the 2nd and 3rd line. That is going to cause serious parsing problems with the command. -
How to create a select query to compare a collection via jpa?
I'm new to jpa (java persistence) and its query language.
If I've an entity named "Person" with a collection of Addresses (a one-to-manay relationahip), how do I create a Select query to get a person by using a collection of Addresses as its input parameter?
Would "SELECT p FROM Person p JOIN p.addresses = :addresses" work?Hi,
You can try the below logic:
STATISTICS.date_reg} >= '27-may-2011' and { STATISTICS.date_reg} < ' 27-June-2011'
I guess you are trying to apply this condition.
Here in selection formula you need not to give select and from.
Cheers,
Kiran -
How to month in select query.....for vbap
Hi Experts,
I am using selection option Listbox ( January, February, March, etc...).
How to use it in select query for table vbap (Shown below),
I want to retrieve data of january from vbap and matches erdat in pa_mnr.
parameters: pa_mnr type ztemp-zlist as listbox visible
length 13 default 'January'.
select * from vbap into corresponding fields of table it_vbap
where matnr in matnr1 and
gsber = 'HIP' and
vstel = 'BSP' and
erdat in pa_mnr.hi,
take the date from the select option.
let say you have date, month and year seperate select option..
then look at some FM whcih gives month number for your month name..
concatenate all the three separated by dot and put it in a variable of type datum..
now your variable contains the user selected date.
you can write your select query.
rewards if useful
regards,
nazeer -
SQL SELECT Query Help ..Please its very Urgent!!
Hi All,
I am having Oracle Database whice is storing 1000's of records daily.
I need to select some information based on date and time.
I am having two coloumns for Date and time. The first column(testDate) of type Date stores date as MM/DD/YY format and the second column(testTime)of type Numeric stores the time in seconds.
The Example data is :
testDate ------=-- testTime
11/12/2002 --- 35000
11/12/2002 --- 43000
11/12/2002 --- 45000
11/12/2002 --- 75000
11/13/2002 --- 2000
11/13/2002 --- 3500
11/13/2002 --- 4300
11/13/2002 --- 9800
11/13/2002 --- 23000
11/14/2002 --- 5000
11/14/2002 --- 10000
11/14/2002 --- 15000
How can i write a SELECT Query to get the records of specific date and seconds to next day specific date and seconds.I mean i want all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
If any one helps me in this regard iam very thank full to them.Its very urgent for me.
ThanksHi m7nra,
I used the query as
SELECT * FROM table
WHERE testDate + (testTime/(24*60*60)) BETWEEN TO_DATE('MM/DD/YYYY','12.11.2002') AND TO_DATE('MM/DD/YYYY','14.11.2002')
its giving DATE FORMAT NOT RECOGNIZED error.
The Example data is :
testDate ------=-- testTime
11/12/2002 --- 35000
11/12/2002 --- 43000
11/12/2002 --- 45000
11/12/2002 --- 75000
11/13/2002 --- 2000
11/13/2002 --- 3500
11/13/2002 --- 4300
11/13/2002 --- 9800
11/13/2002 --- 23000
11/14/2002 --- 5000
11/14/2002 --- 10000
11/14/2002 --- 15000
infact i need all the records between 11/12/2002 --- 43000 seconds to 11/14/2002 --- 1000 seconds.
Please help me to find a full query beacuse iam very new to Oracle.
Thanks,
S R Mannava
Maybe you are looking for
-
IPod not recognized by computer and other problems
I have a 3rd generation iPod. When I try to charge it, a folder comes up with an exclamation mark in it. I tried to follow some of the steps on the site, but it didn't seem to work. Also, when I try to connect the iPod to the computer, it just does n
-
Language input - Chinese handwriting is no longer working properly
After my Z10 was auto upgraded to OS 10.3.1.1581, the Chinese handwriting is overwritten on the same character, unless an enter is hit. Is there any special setting that needs to alter? Or there is a fix that I can apply?
-
Volume structure, surface scan
I have a new imac, it's been with me for about 2 months total. I noticed some silly little things happening occasionally....so I used tech tools and did a scan. The volume structure failed....and the surface scan has 2 errors. What's the significance
-
I made a signature in preview - but I have no sign for signature on the second bar - and this after a Combo Update with 10.7.2. Preview is Version 5.5.1 (719.11) german. Should the sign for "signature" not automatically appear in the secon bar?
-
Hi, When I plug a cable in the line out I get this wicked distortion sound in my headphones or my speakers. Does anybody know how to get ride of it? Everything was running perfect before and now I have to unplug using the internal speakers to listen