Query help for where condition
Hi ,
I have String value in table now I require to check that value is valid or not .
I have below Query .
SELECT *
FROM Table TCI
WHERE (ISDATE(SUBSTRING(SUBSTRING(Data,82,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,82,6),5,2)+'-'+'01')<>1 OR LEN(LTRIM(RTRIM(SUBSTRING(Data,82,6)))) < 0 OR SUBSTRING(Data,82,6)='000000')
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,88,6)))) < 0 OR SUBSTRING(Data,88,6)= '000000' OR ISDATE(SUBSTRING(SUBSTRING(Data,88,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,88,6),5,2)+'-'+'01')<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,173,6)))) < 0 OR ISDATE(SUBSTRING(SUBSTRING(Data,173,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,173,6),5,2)+'-'+'01')<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,195,6)))) < 0 OR ISDATE(SUBSTRING(SUBSTRING(Data,195,6),1,4)+'-'+SUBSTRING(SUBSTRING(Data,195,6),5,2)+'-'+'01') <>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,217,7))))<0 OR ISNUMERIC(LTRIM(RTRIM(SUBSTRING(Data,217,7)))) <> 1)
AND ISNUMERIC(REPLACE(SUBSTRING(Data,334,10),'-','0'))<>1
AND ISNUMERIC(SUBSTRING(Data,345,10))<>1
AND ISNUMERIC( SUBSTRING(Data,355,10))<>1
AND ISNUMERIC(SUBSTRING(Data,416,8))<>1
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,104,6))))<0 OR ISNUMERIC(SUBSTRING(Data,104,6))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,145,7))))<0 OR ISNUMERIC(SUBSTRING(Data,145,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,152,7))))<0 OR ISNUMERIC(SUBSTRING(Data,152,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,159,7))))<0 OR ISNUMERIC(SUBSTRING(Data,159,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,166,7))))<0 OR ISNUMERIC(SUBSTRING(Data,166,7))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,179,3))))<0 OR ISNUMERIC(SUBSTRING(Data,179,3))<>1)
AND (LEN(LTRIM(RTRIM(SUBSTRING(Data,201,3))))<0 OR ISNUMERIC(SUBSTRING(Data,201,3))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,365,10),'-','0'))<>1 OR ISNUMERIC( REPLACE(SUBSTRING(Data,365,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,375,10),'-','0'))<>1 OR ISNUMERIC( REPLACE(SUBSTRING(Data,375,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,385,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,385,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,395,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,395,10),'-','0'))<>1)
AND (ISNUMERIC(REPLACE(SUBSTRING(Data,405,10),'-','0'))<>1 OR ISNUMERIC(REPLACE(SUBSTRING(Data,405,10),'-','0'))<>1)
I need only invalid record set from below Query ;
like; If it is not isdate and is_numeric type for particular row then it return only that row.
currently i'm facing issue like whole string is invalid in that case it gives row .
should I use case statement in where clause ?
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. http://techequation.com
I need only invalid record set from below Query ;
like; If it is not isdate and is_numeric type for particular row then it return only that row.
currently i'm facing issue like whole string is invalid in that case it gives row .
should I use case statement in where clause ?
Hi PrajapatiNeha,
Your requirement is confusing. Judging from the query, the column data
seems to be a string which consists of fixed length date or numberic format substrings, so you are verifying each substring is valid and need to select the invalid substrings?
If that is your requirement, why not just extract the substrings into a derived table and filter based on the derived table? The substrings in the derived table will give a more directly overview of your long data string.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support
Similar Messages
-
Dynamic select query with dynamic where condition
Hi all,
I want to use the dynamic select query with dynamic where condition. For that I used the below code but I am getting dump when using this code.
Please advice, if there is any other way to achieve this requirement.
Thanks,
Sanket Sethi
Code***************
PARAMETERS: p_tabnam TYPE tabname,
p_selfl1 TYPE edpline,
p_value TYPE edpline,
p_where1 TYPE edpline .
DATA: lt_where TYPE TABLE OF edpline,
lt_sel_list TYPE TABLE OF edpline,
l_wa_name TYPE string,
ls_where TYPE edpline,
l_having TYPE string,
dref TYPE REF TO data,
itab_type TYPE REF TO cl_abap_tabledescr,
struct_type TYPE REF TO cl_abap_structdescr,
elem_type TYPE REF TO cl_abap_elemdescr,
comp_tab TYPE cl_abap_structdescr=>component_table,
comp_fld TYPE cl_abap_structdescr=>component.
TYPES: f_count TYPE i.
FIELD-SYMBOLS : <lt_outtab> TYPE ANY TABLE,
* <ls_outtab> TYPE ANY,
<l_fld> TYPE ANY.
struct_type ?= cl_abap_typedescr=>describe_by_name( p_tabnam ).
elem_type ?= cl_abap_elemdescr=>describe_by_name( 'F_COUNT' ).
comp_tab = struct_type->get_components( ).
comp_fld-name = 'F_COUNT'.
comp_fld-type = elem_type.
APPEND comp_fld TO comp_tab.
struct_type = cl_abap_structdescr=>create( comp_tab ).
itab_type = cl_abap_tabledescr=>create( struct_type ).
l_wa_name = 'l_WA'.
CREATE DATA dref TYPE HANDLE itab_type.
ASSIGN dref->* TO <lt_outtab>.
*CREATE DATA dref TYPE HANDLE struct_type.
*ASSIGN dref->* TO <ls_outtab>.
* Creation of the selection fields
APPEND p_selfl1 TO lt_sel_list.
APPEND 'COUNT(*) AS F_COUNT' TO lt_sel_list.
** Creation of the "where" clause
*CONCATENATE p_selfl1 '= '' p_value ''.'
* INTO ls_where
* SEPARATED BY space.
*APPEND ls_where TO lt_where.
* Creation of the "where" clause
APPEND p_where1 TO lt_where.
* Creation of the "having" clause
l_having = 'count(*) >= 1'.
* THE dynamic select
SELECT (lt_sel_list)
FROM (p_tabnam)
INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>.
* WHERE (lt_where).Hi Sanket,
The above given logic of mine works for you, put the code in the If condition and try-
just like below:
IF NOT P_EBELN IS INITIAL.
lt_where = '& = ''&'' '.
REPLACE '&' WITH p_ebeln INTO lt_where.
REPLACE '&' WITH field_value INTO lt_where.
SELECT (lt_sel_list) INTO CORRESPONDING FIELDS OF TABLE <lt_outtab>
FROM (p_tabnam)
WHERE (lt_where).
ENDIF.
thanks\
Mahesh -
Select query with optional where condition
Hi,
Can Anybody help me out in the following problem?
I have the following query in a procedure.
SELECT replace(shipper_name,'\',' ') as shipper,
sum(teus / cntSailings) as teus
FROM VW_CONTRIBUTION,
VW_TOTAL_SAILINGS
WHERE VW_CONTRIBUTION.dir = VW_TOTAL_SAILINGS.DIR
AND VW_CONTRIBUTION.line = VW_TOTAL_SAILINGS.LINE
AND VW_CONTRIBUTION.accounting_month = VW_TOTAL_SAILINGS.ACCOUNTING_MONTH
AND VW_CONTRIBUTION.accounting_year = VW_TOTAL_SAILINGS.ACCOUNTING_YEAR
AND VW_CONTRIBUTION.Principal = arg_principal
AND VW_CONTRIBUTION.Dir = arg_direction
AND VW_CONTRIBUTION.line in ( arg_service )
AND VW_CONTRIBUTION.POL_country = arg_pol
AND VW_CONTRIBUTION.POd_country = arg_pod
AND VW_CONTRIBUTION.salesOffice = arg_SalesOffice
AND VW_CONTRIBUTION.salesregion = arg_SalesRegion
AND VW_CONTRIBUTION.cargo_type = arg_txtCargoType
AND VW_CONTRIBUTION.eqgroup = arg_ContType
AND VW_CONTRIBUTION.eq_size = arg_txtSize
AND VW_CONTRIBUTION.acct_date between arg_from_date and arg_end_date
GROUP BY shipper_name
ORDER BY teus desc;
Here some of the arguments are optional(Eg : VW_CONTRIBUTION.salesOffice, AND VW_CONTRIBUTION.eqgroup etc. ) and the values can be null. When they are null, I want them to be excluded from the where condition. Can anybody suggest me a solution for this?
Thanks,
Shalet.I guess i misunderstood your original question.
The clause
AND (VW_CONTRIBUTION.salesOffice = arg_SalesOffice OR VW_CONTRIBUTION.salesOffice IS NOT NULL)
will cause the where clause to evaluate to FALSE anytime salesOffice IS NULL so the record will be excluded.
I thought you were asking how to not compare the value if the field contained a NULL.
Glad you found what you wanted. -
Single SQl Query with different where conditions
Experts,
I have a requirement to design a report. Here are the details
I have Report table layout
Profit center Gross sales (This Year) Gross Sales (Last Year) % change Year of Year
The Report has a selection of entering the Start Date.
I have a single table in oracle which has profit center and Gross Sales Values on daily basis.
I want to write a single sql query to calculate both Gross Sales current year and Gross Sales Last Year. I can calculate Gross Sales Current Year by putting the where condition for start date = Current Year Date which i pass through report. I want to calculate the Gross Sales Last Year in the Same query by putting the different where condition i.e start date = Last Year date based on the date input.
I dont know how to put two where conditions in single query for two different columns.
Any help will be appreciated.
Thanks in advance
Regards
Santoshinstead of changing your where clause couldn't you just determine the yearly totals from your table and then use the lag statement to get last years total?
something like this?
I just made up 10,000 days worth of sales and called it fake table it is supposed to represent a variant of the table you were describing as your base table.
with fake_table as
( select trunc(sysdate + level) the_day,
level daily_gross_sales
from dual
connect by level < 10001
select yr, year_gross_sale, lag(year_gross_sale) over (order by yr) prev_year_gross_sale,
(year_gross_sale - lag(year_gross_sale) over (order by yr))/year_gross_sale * 100 percent_change
from
(select distinct yr, year_gross_sale from
select the_day,
daily_gross_sales,
extract(year from the_day) yr,
extract(year from add_months(the_day,12)) next_yr,
sum(daily_gross_sales) over (partition by extract(year from the_day)) year_gross_sale
from fake_table
order by yr
) -
Different execution plan for same query but for different condition value
Hi All,
I'm facing a strange situation where same query for different condition not working.
1--
Select top 10 * from revenuefact(nolock)
where feecode ='OW4'
2--
Select top 10 * from revenuefact(nolock)
where feecode ='BTE'
1st query is returning result easily but 2nd query is taking too long. Column
feecode has already Non-clustered index and Clustered index is also available for another col RevenueSID.
I was surprised when checked the query execution plan for both the above queries which is quite different (as per attached below). Can anyone suggest me the reason behind it.
And solution for the same. One more thing that data for feecode BTE is inserting through different source instead of others feecode and table contains more than 300 million rows.When I speak with people inside Microsoft who work with the optimizer, the refuse to accept the work "bug" when a query produces the correct result, but with a suboptimal plan. They prefer to use the word "limitation".
The limitation here is that when the optimizer compares two plans, it only looks at the estimated cost. As far as I know, it does not perform any analysis from the perspective "what if the statistics are wrong"? They do provide the hint OPTIMIZE
FOR UNKNOWN, but that does not work then there is a constant as in this case.
The optimizer will surely distinguish between TOP 10 and TOP 10000000. With the latter, you have all reason to expect a Clustered Index Scan no matter which value you search for - unless you pick a value for which the histogram indicates that there are no
rows.
Interesting enough, I was able to reproduce the situation in my Northgale database, which is an inflated version of Northwind, and where statistics should be accurate.
SELECT TOP 10 * FROM Orders WHERE EmployeeID = 8
results in a CI scan, and so does also EmployeeID = 7, and even 5. There are only 2292 rows out of a total of 344305 rows. If I try EmployeeID 808 for which there are 1797, the optimizer goes for the index seek.
Erland Sommarskog, SQL Server MVP, [email protected] -
Please help - NE where condition in SELECT statement
Dear experts,
I am posting a section of my codes here for your review on performance tuning.
In my second select statement, I used a "NE" where condition. I read somewhere in this forum that using "NE" where condition is not a good decision for improving codes' performance. What alternatives can I have to achieve the same purpose? May I use "NOT IN" here instead? Or do I use a LOOP for this (a rather manual way)?
Just to let you all know that I still consider myself quite inexperienced in ABAP - please also let me know how I can better improvise my programming techniques in the posted codes here too.
I will be most glad to provide you with further information if needed - just let me know.
Many THANKS in advance!
IF p_noncis = 'X'. " Non CIS category of spend selected
" zfi_cis_mat_grp is a bespoke table that stores all CIS MATKL
" and it has two fields only - MANDT and MATKL
SELECT * FROM zfi_cis_mat_grp
INTO TABLE gt_cis_mat_grp.
IF gt_cis_mat_grp IS NOT INITIAL.
SELECT ebeln
ebelp
matkl
FROM ekpo
INTO TABLE gt_ekpo
FOR ALL ENTRIES IN gt_cis_mat_grp
WHERE matkl NE gt_cis_mat_grp-matkl. " NE where condition - is this OK?
ENDIF.
IF gt_ekpo IS NOT INITIAL.
IF s_sakto IS NOT INITIAL.
SELECT ebeln
ebelp
sakto
FROM ekkn
INTO TABLE gt_ekkn
FOR ALL ENTRIES IN gt_ekpo
WHERE ebeln = gt_ekpo-ebeln AND
ebelp = gt_ekpo-ebelp AND
sakto IN s_sakto.
IF gt_ekkn IS NOT INITIAL.
SELECT bukrs
lifnr
belnr
budat
cpudt
xblnr
ebeln
ebelp
zfbdt
zterm
zlspr
FROM bsik
INTO TABLE gt_bsik
FOR ALL ENTRIES IN gt_ekkn
WHERE bukrs IN s_bukrs AND
lifnr IN s_lifnr AND
budat IN s_budat AND
cpudt IN s_cpudt AND
xblnr IN s_xblnr AND
ebeln = gt_ekkn-ebeln AND
ebelp = gt_ekkn-ebelp AND
qsskz NE ''.
ENDIF.
ELSE.
SELECT bukrs
lifnr
belnr
budat
cpudt
xblnr
ebeln
ebelp
zfbdt
zterm
zlspr
FROM bsik
INTO TABLE gt_bsik
FOR ALL ENTRIES IN gt_ekpo
WHERE bukrs IN s_bukrs AND
lifnr IN s_lifnr AND
budat IN s_budat AND
cpudt IN s_cpudt AND
xblnr IN s_xblnr AND
ebeln = gt_ekpo-ebeln AND
ebelp = gt_ekpo-ebelp AND
qsskz NE ''.
ENDIF.
ENDIF.
ELSE. " Complete list of category of spend selected
SELECT bukrs
lifnr
belnr
budat
cpudt
xblnr
ebeln
ebelp
zfbdt
zterm
zlspr
FROM bsik
INTO TABLE gt_bsik
WHERE bukrs IN s_bukrs AND
lifnr IN s_lifnr AND
budat IN s_budat AND
cpudt IN s_cpudt AND
xblnr IN s_xblnr AND
qsskz NE ''.
ENDIF.Hi,
If you want to remove th NE option then try this way..
SELECT bukrs
lifnr
belnr
budat
cpudt
xblnr
ebeln
ebelp
zfbdt
zterm
zlspr
FROM bsik
INTO TABLE gt_bsik
WHERE bukrs IN s_bukrs AND
lifnr IN s_lifnr AND
budat IN s_budat AND
cpudt IN s_cpudt AND
xblnr IN s_xblnr .
IF SY-SUBRC EQ 0.
Delete gt_bsik where qsskz EQ ' '.
ENDIF. -
SQ01 Query Help for (MKPF and MSEG)
Is their anyway to have the field MSEG-ERFMG show up on the query results as postive or negative color or use a "-" or "+". Need to try and show whether is was a negative or postive movement.
F1 help for MSEG-SHKZG
Debit/credit indicator in revaluation
This indicator is used for internal program control.
Please do not change the entry in this field.
Any changes made could lead to program errors or terminations.
I guess the "sign" is defined trough this field ("S" - sollen (debit), "H" - haben (credit)). If my assumption is true, you won't be able to see + / - in MSEG-ERFMG simply because this field contains no information on the sign.
Using ABAP code you can solve it (or in SQ01 you can use calculated field in your query...I'm not sure you can define that calculated field to cover your requirement...).
Regards,
Csaba
Edited by: Csaba Szommer on May 12, 2009 11:20 PM -
Require help on the Query related to where condition
Hi All,
i am a java developer and was required to write a query for some of my operations to get the data from oracle database.
i am stuck at one point. please help me.
i have table with 3 columns.
ID | Name | Value
1 | ser | x
1 | Bus | a
1 | pol | b
2 | ser | x
2 | Bus | a
2 | pol | c
3 | ser | y
3 | Bus | a
3 | pol | b
4 | ser | y
4 | Bus | d
4 | pol | e
i have written query like below.
Select ID from table where Name in ('ser','Bus','pol') and Value in ('x','a','b');
i am getting out put as ID = 1,2,3
but i should get the output as ID=1
i should get the ID which satisfies all the given attributes and values.
i cannot use the AND for each Name and Value here as i the no.of values inName or Value field may increase and that will be dynamically passed from my java class.
Immediate help is appreciated.
thanks a lotSomething like this will deal with multiple values and treat the name value pairs together...
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as ID, 'ser' as Name, 'x' as Value from dual union all
2 select 1, 'Bus', 'a' from dual union all
3 select 1, 'pol', 'b' from dual union all
4 select 2, 'ser', 'x' from dual union all
5 select 2, 'Bus', 'a' from dual union all
6 select 2, 'pol', 'c' from dual union all
7 select 3, 'ser', 'y' from dual union all
8 select 3, 'Bus', 'a' from dual union all
9 select 3, 'pol', 'b' from dual union all
10 select 4, 'ser', 'y' from dual union all
11 select 4, 'Bus', 'd' from dual union all
12 select 4, 'pol', 'e' from dual)
13 --
14 -- end of test data
15 --
16 ,i as (select 'ser|x,Bus|a,pol|b' as r from dual)
17 --
18 -- end of input
19 --
20 ,split as (select regexp_substr(r,'[^,]+',1,rn) as pair
21 from i
22 cross join (select rownum rn
23 from dual
24 connect by rownum <= (select length(regexp_replace(r,'[^,]'))+1 from i))
25 )
26 select id
27 from t, split
28 where name = regexp_substr(pair,'[^|]+',1,1)
29 and value = regexp_substr(pair,'[^|]+',1,2)
30 group by id
31* having count(*) = (select count(*) from split)
SQL> /
ID
1It's then just a case of providing the input in the correct format. -
Need help for filter condition
Hello All,
I am currently using Oracle 10g and stuck for the filter condition.
We have incident numbers and 5 activities to complete that incident. All the activities are same for each incident. When status of all the activities are done the incident is supposed to be completed.
In my scenario, I want to select only those incidents where 2 (activity BB and CC) of 5 activities have status 'Done' and 1 activity (activity DD) has status 'Done' or 'Not Applicable'. I have tried to do this by certain filter combinations but couldnt achieve required result. I hope I will get this query answered here.
Below is sample table.
Incident Number
Activity Name
Activity Status
10
AA
In Progress
10
BB
Done
10
CC
In Progress
10
DD
Done
10
EE
Not Started
20
AA
In Progres
20
BB
Done
20
CC
Done
20
DD
Not Applicable
20
EE
Done
My selection criteria is
Activity Name
Activity Status
BB
Done
CC
Done
DD
Done or Not Applicable
Now, in this case I would like to see incident number 20 only in my result as it has BB activity Done, CC activity Done and DD activity Not Applicable which serves my criteria.
Any help will greately appreciated.
Thanks,
Shantanu971628 wrote:
Hi RaminHashimzadeh,
My selection criteria is
Activity Name
Activity Status
BB
Done
CC
Done
DD
Done or Not Applicable
I dont want incident numbers where status of activity BB and CC = Not Applicable. It should only be 'Done' for BB and CC. It could be 'Done' or 'Not Applicable' only for DD activity. Your query would not serve my requirement.
OK
check this :
select Incident from t
group by Incident
having count(case when (ActivityStatus = 'Done' and Activity in ('BB','CC')) or
(ActivityStatus in ('Done','Not Applicable') and Activity = 'DD')
then 1 end) = 3
Ramin Hashimzade -
Query Help for reporting on last receipt qty
SBO Version: 8.82 PL11
Hello Forum,
I am looking for some help devising a command behind a crystal report. We are hoping to achieve the last receipt quantity. To arrive at this we would like it to get the last GRPO for an item and total the quantity on that particular GRPO. In addition to this, we want to consider all the lines on the document and SUM them.
At present, the query I have is as follows:
Select SUM(c0.Quantity) from PDN1 c0 WHERE c0.ItemCode = T1.ItemCode AND Shipdate = (select Max(ShipDate) from PDN1 C0 INNER JOIN OPDN c1 ON c0.DocEntry = c1.DocEntry where C0.Itemcode =T1.ItemCode AND c1.DocStatus <> 'C'))
Any assistance would be greatly received.
Thanks
SarahHi Sarah,
Please repost to the SAP Business One Application space.
-Abhilash -
How to write the select query with complex where condition
Hi all,
Can u help me in writing following select query.
select * from zu1cd_corr where time_stamp between firstday and lastday .
In the above query time_stamp contains the date and time.
where as firstday and lastday contains the dates.
I need to compare the date in the time_stamp with the firstday and lastday.
But time_stamp contains the time also and it is char of 14 characters length.Hi,
If that is the case u can do as advait specified....
if the firstday and secondday are select-options then declare two more variables having 14 character length and then concatenate '000000' to firstday variable and '240000' to last day variable and then write ur query.
CLEAR : lv_firstday,
lv_lastday.
concatenate firstday '000000' to lv_firstday.
concatenate lastday '240000' to lv_lastday.
ranges : r_Date for zu1cd_corr-time_stamp.
r_date-sign = 'I'.
r_date-option = 'BT'.
r_Date-low = lv_firstday.
r_Date-high = lv_lastday.
append r_date.
select * from zu1cd_corr into table it_zu1cd_corr where time_stamp in r_Date.
I hope it helps.
Regards,
Nagaraj -
Query with two where conditions
HI
SELECT ENAME FROM EMP WHERE
SAL > 1000 AND JOB='CLERK';
How to implement in CMP(Entity bean)
thank uat this point mapping to do this king of query would be on the container specific file. I will tellyou how this is done on a Orion App server. I bet that others are close to the same.
first you make a finder method in your bean for the enploy name:
Collection findBigClerk();
Orion generates a file from the ejb-jar.xml file called orion-ejb-jar.xml. this is where the O/R mapping is changed for the beans.
each method in a bean has short definition
<finder-method query="EMP.SAL>1000 and EMP.JOB='CLERK'">
Assuming that the CMP is mapped to the EMP table when you call findbigClerk it will add the above query to as a WHERE clause.
Then get the name from the interface.
Again, this is how I would do this on an Orion App server. Others will be simular until O/R mapping is moved from server-specific to the ejb-jar.xml file
hope this helps a little -
Query help for archive log generation details
Hi All,
Do you have a query to know the archive log generation details for today.
Best regards,
Rafi.Dear user13311731,
You may use below query and i hope you will find it helpful;
SELECT * FROM (
SELECT * FROM (
SELECT TO_CHAR(FIRST_TIME, 'DD/MM') AS "DAY"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '00', 1, 0)), '999') "00:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '01', 1, 0)), '999') "01:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '02', 1, 0)), '999') "02:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '03', 1, 0)), '999') "03:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '04', 1, 0)), '999') "04:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '05', 1, 0)), '999') "05:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '06', 1, 0)), '999') "06:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '07', 1, 0)), '999') "07:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '08', 1, 0)), '999') "08:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '09', 1, 0)), '999') "09:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '10', 1, 0)), '999') "10:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '11', 1, 0)), '999') "11:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '12', 1, 0)), '999') "12:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '13', 1, 0)), '999') "13:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '14', 1, 0)), '999') "14:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '15', 1, 0)), '999') "15:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '16', 1, 0)), '999') "16:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '17', 1, 0)), '999') "17:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '18', 1, 0)), '999') "18:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '19', 1, 0)), '999') "19:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '20', 1, 0)), '999') "20:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '21', 1, 0)), '999') "21:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '22', 1, 0)), '999') "22:00"
, TO_NUMBER(SUM(DECODE(TO_CHAR(FIRST_TIME, 'HH24'), '23', 1, 0)), '999') "23:00"
FROM V$LOG_HISTORY
WHERE extract(year FROM FIRST_TIME) = extract(year FROM sysdate)
GROUP BY TO_CHAR(FIRST_TIME, 'DD/MM')
) ORDER BY TO_DATE(extract(year FROM sysdate) || DAY, 'YYYY DD/MM') DESC
) WHERE ROWNUM < 8;Hope That Helps.
Ogan -
Query transform with where condition not equal to
All,
I have a two tables in a Data services job where I am using a Query transform to load the data from these two tables into another table. In the where tab in query transform i had a conditon saying table1.column1 <> table2.column1 and table1.column2 <> table2.column2.
I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing.
The equivalent SQL query for the above transform has to be:
select * from table1 inner join table2 on table1.column1 = table2.column1 where table1.column1 <> table2.column1 and
table1.column2 <> table2.column2.
Any thoughs on how to fix my query transform.
ThanksHi
As per your below statement
"I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing."
If you trying to get the records from table-1 which are not in table-2 (as you trying table1-table2)
you can try logic in query transformation where clause
not table1.field1 in (table2.field1)
and
not table1.field2 in (table2.field2)
it gives you count from table1 only
Regards
Ahalya Gopinath -
Query help for sales employee sales
Hi....
How can we have a query for
Name of sales employee
Item group
Item name
Total selling amount
Total sales order
Total delivery
Total AR invoice
Please help
Thanks a lotHi,
What Total selling amount do you need? Invoice - Credit Memo?
How about the other Total, total count or total amount?
Thanks,
Gordon
Maybe you are looking for
-
Create a report based on sample data!
Hello all, I would like to get some helps for creating a report based on the following table data in the database: Class | Name | Student ======================================= 1 | Algebra
-
I have the iphone 4 and just updated to iOS 6 and all my text messages are gone. Can I get them back?
-
I have a 30g Fifth generation Ipod. I cannot delete the contacts. Under the "Contacts" tab I have unchecked the "sync from" bubble and re-synced. Still the contacts are there. I have tried "Enabling Disk Use", gone into the control panel, pulled up t
-
I am using Internet Explorer and at present using a PC laptop as my eMac has BlueScreen-itis for the moment. Wonder if anyone can assist me with the following: At the top of the Int Exp page I have two rows, first one starting with File, Edit, View,
-
ICal Feature, Bug, or Configuration Problem?
We have a school calendar running on iCal Server (10.6.4) called "CS Calendars". Each user has one default calendar when the account is created on the local MacBook (10.6.4). Many users have created additional calendars under "CS Calendars" so that t