Create Sequence Number with Select Query
Hi All,
I would like to create a sequence number in oracle but instead of hard coding the "start with" I want to select the max value of the primary key of a table and add 1 and use this instead:
So what I want is:
CREATE SEQUENCE crg_mrec_seq
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH select max(primarykey)+1 from table1
INCREMENT BY 1
CACHE 20;I'm guessing I need to pass this max value as a variable into the create sequence number but I'm not sure what syntax to use.
Thanks,
Ed
spalato76 wrote:
Hi All,
I would like to create a sequence number in oracle but instead of hard coding the "start with" I want to select the max value of the primary key of a table and add 1 and use this instead:
So what I want is:
CREATE SEQUENCE crg_mrec_seq
MINVALUE 1
MAXVALUE 999999999999999999999999999
START WITH select max(primarykey)+1 from table1
INCREMENT BY 1
CACHE 20;I'm guessing I need to pass this max value as a variable into the create sequence number but I'm not sure what syntax to use.
Thanks,
Edconstruct SQL statement & then EXECUTE IMMEDIATE
Similar Messages
-
How to create a DB Adapter with select query having inner query
Hi All,
I am trying to create a DB Adapter with select query. The query has some inner queries in it. It is just like this select a, b, c, (select d from e) d, (select e from e) e from tablename.
The problem here is with the xsd generated for this query. Xsd is not getting generated properly for all the fields it is just getting generated till c element and when it encounters
the inner query it is stopping the generation of xsd. So for the above query the xsd is something similar to the below
<xs:complexType name="rewOutput">
<xs:sequence>
<xs:element name="a" type="xs:string" nillable="true"/>
<xs:element name="b" type="xs:string" nillable="true"/>
<xs:element name="c" type="xs:string" nillable="true"/>
<xs:element name="select_d" type="xs:string" nillable="true"/>
</xs:sequence>
</xs:complexType>
as shown above the xsd is just getting generated till the first inner query. What should be done to get the full fledged xsd. Should it be manually built ?? Please help me on this.
Thanks In Advance.
Edited by: 959766 on Nov 30, 2012 1:20 AMHi,
I don't think the parser will be able to understand your query properly... I would try building the xsd manually...
Cheers,
Vlad -
Select sequences number in a Query
I am facing problems while selecting the Sequence Number in a query.
create or replace view vfilemanifest as
(select abc.* , ts.* from (select filemanifestid.nextval from dual) abc ,
( select distinct batchid,custodianid from
tbatch tbat ,tcustodians tcstd, EXT_TAB_MASTERS ext_tab
where tbat.batchname = ext_tab.batchname
and tbat.batchpath = ext_tab.batchpath
and tcstd.custodianname = ext_tab.custodianname
and tcstd.custodianadd = ext_tab.custodianadd
)ts )
SQL> /
(select abc.* , ts.* from (select filemanifestid.nextval from dual) abc ,
ERROR at line 2:
ORA-02287: sequence number not allowed here
Please Advice
Regards
SushantI'm sorry but that doesn't make it any clearer to me. This
using External Tables , View , Collection , bulk collect and Forall Insert is an implementation, not a business requirement. You might find some enlightenment in want to create a pl/sql table type dynamically I answered.
Anyway, I think what you want to do is this: (warning, untested code ahead!)
DECLARE
TYPE lrec IS RECORD (
id NUMBER,
batchid tbatc.batchid%TYPE,
custodianid tcustodians.custodianid%TYPE);
TYPE ltab IS TABLE OF lrec;
llist ltab;
BEGIN
SELECT abc.* , ts.* BULK COLLECT INTO llist
FROM (select filemanifestid.nextval from dual) abc
, ( select distinct batchid,custodianid
from tbatch tbat ,tcustodians tcstd, EXT_TAB_MASTERS ext_tab
where tbat.batchname = ext_tab.batchname
and tbat.batchpath = ext_tab.batchpath
and tcstd.custodianname = ext_tab.custodianname
and tcstd.custodianadd = ext_tab.custodianadd
)ts
END;
/Cheers, APC -
Creating Target group with Bi Query
Hi,
I am trying to create Target group with BI query, for that I created one query on real time info cube with 0BPARTNER, 0BP_GUID and selected all navigational attributes. In the query info object properties u2013 Advance setting I selecting u201C Values from Master Data Tableu201D & Access Type u201C Master Datau201D , In query Property u2013 selected u201C Allow External Access to Queryu201D
In CRM while creating Data source I can see the In objects selected in the query u2013 selected Business partner info object as 0BP_GUID ,In the attribute list I just selected one item Industry code against the above data source, while running the Segment Builder when I selected the industry code it gives me 0 business partner where as I am having 20 BP with that Industry code.
I appreciate your help ASAP.
Regards,
Rajiv JainHi Rajiv
I have the same issue with my BI Query. Hope you have resolved by now, if you have please do let me know.
What we have done is, created a BI Query and used this query in in CRM datasource, then created some filters where i can see the objects in the query while creating filters in Attributes List. But when we use these filters to create Target group, its not resulting any results in the query, i mean not brining any values on segmentation area. This issue is only in Production as we have already tested in Test and passed without any problems. But in Production we have this issue, i m not sure why this is happening, i spoke to BW team regarding this and they are not sure eitherl. If you know could you please let me know
Thank you in advance
Regards
shankar -
So, I work on a legacy CF web site and there are numerous SELECT * FROM USERS_TABLE queries all over the site.
Well, we changed the structure of said table in the database on our Testing and Staging sites, with no issues.
When we pushed up to our production environment and changed the structure of the production DB table, the server kept kicking back "Value can not be converted to requested type."
After doing some searching out there, it looks like CF caches the structure of the table, and you either have to restart CF to clear it, or rename and then name-back the DSN to fix the issue.
http://www.bennadel.com/blog/194-ColdFusion-Query-Error-Value-Can-Not-Be-Converted-To-Requ ested-Type.htm
That said, this doesn't happen in our testing and staging environments - so what would be the difference?
Is there some setting I need to change in the CF Admin to keep this from happening again?Also, if you can use a Stored Procedure to retrieve the data, do so. Standard queries gets all the information, anyway, chokes bandwidth passing it all to the CF server, and forces the CF server to filter, sort, and format the data. SPs tell the db server to get ONLY the data requested, and forces the db server to filter and sort the data, leaving only formatting to the CF server.
That's not true. The only time CF messes with data returned from the DB is if there's a maxrows attribute, and the record set returnded from the DB has more than that number of records... which causes CF to truncate the recordset to the correct size before returning it. The DB might or might not stop sending rows down to CF after CF says "yeah, I've got all I want now".
Other than that, for all intents and purposes all CF does with the SQL is pass it to the DB and wait for an answer. The only thing it does to the returned data is to create a CF record set ("query") with it... this does not involve any filtering and sorting.
Adam -
Problem with select query inside a function.
Hi,
i have created a function as
create or replace function "NEW"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
select sum(allocation_percent) into v_alo from employeeproject where start_date < s_date and end_date > e_date and pid != 'BPDE-KER12' and employee_id = emp;
select allocation_percent into v_alo2 from employeeproject where start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and employee_id = emp;
select max(end_date) into v_date from employeeproject where employee_id=emp having max(end_date) <= S_DATE;
if v_alo < 100 then
return 1;
else if v_alo2 = 100 then
return 2;
else if v_date < s_date then
return 3;
else
return 4;
end if;
end if;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;it is compiled correctly.
when executing the function with
select abc.a,new(a,'03-jan-2011','04-jan-2011') "status" from abc where new(a,'03-jan-2011','04-jan-2011') in (1,2,3,4);it is returning
A status
1 5
2 5
3 5
instead of
A status
1 1
2 2
3 3
and when i comment any two select statements then some part of my ans is correct.
unable to understand the behaviour.
can any pls help me understand it.
Thanks,
hariHi,
thanks for the reply, and sorry for my ugly code.
i am using Oracle database 10g express edition.
Case could be a option to use but i need to figure why my query is not returning any value when used together.
my requirement is to find
the employees who are have allocation percent sum < 100 for a defined period(excluding pid=BPDE-KER12) and
employee who is mapped to pid=BPDE-KER12 not in my first requirement in that period and
the employees whose latest end date is less than the new start date.
i have tried the new modified code as you said but this time it returns null, not even exceptions running.
i divide my requirement into three functions which will return value.
1. create or replace function "NEW4"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to check if the employee total percentage is <100 then return 1 else return 4
select sum(allocation_percent) into v_alo from pm_employee_project
where
start_date < s_date and end_date > e_date and pid !='BPDE-KER12' and employee_id = emp;
if v_alo < 100 then
return 1;
elsif v_alo2 = 100 then
return 2;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW4(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
result,
A STATUS
1 *1*
2 4
3 4 2.create or replace function "NEW5"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--To select employee who are in a specific pid.
select allocation_percent into v_alo2 from pm_employee_project where
start_date < s_date and end_date > e_date and pid = 'BPDE-KER12' and
employee_id = emp;
if v_alo2 = 100 then
return 2;
elsif v_alo < 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW5(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 *2*
3 5 3. create or replace function "NEW6"
(emp in number,
s_date in DATE,
e_date in DATE)
return number
is
v_alo number default 0;
v_alo2 number default 0;
v_date date;
begin
--to select the employee whose project end date is less thann the new date.
select max(end_date) into v_date from pm_employee_project where
employee_id=emp having max(end_date) <= S_DATE;
if v_alo2 = 100 then
return 2;
elsif v_alo = 100 then
return 1;
elsif v_date < s_date then
return 3;
else
return 4;
end if;
exception
when NO_DATA_FOUND then
return 5;
end;
then,
select abc.a,NEW6(a,'03-jan-2011','30-jan-2011') "STATUS" from abc
Result,
A STATUS
1 5
2 5
3 *3* so my function works properly individually, but i want all the three conditions in a single function with same order as above 1 then 2 and then 3.
and when i try to do it that way i am not getting my result as
A STATUS
1 *1*
2 *2*
3 *3*
so how can i proceed.
my input table values,
select * from abc
A B C
1 2 2
2 1 3
3 1 2
select * from pm_employee_project
varchar2 varchar2 date date date varchar2
EMPLOYEE_ID PID START_DATE END_DATE ALLOCATION_PERCENT SUPERVISOR_ID
1 10 02-JAN-11 31-JAN-11 89 -
1 20 05-JAN-11 20-JAN-11 9 -
1 BPDE-KER12 21-JAN-11 31-JAN-11 11 -
2 BPDE-KER12 01-JAN-11 31-JAN-11 100 -
3 30 01-JAN-10 01-JAN-11 100 -
Create sequence start with variable
Trying to create a sequence within plsql passing a variable into the start with clause. I am getting the 'ora-01722: invalid number' error. Thoughts?
-- Created on 06-Jun-07 by CARSONBC
declare
-- Local variables here
v_staff_proxy_user_seq_num number;
begin
-- find max value
select max(staff_proxy_user_id)+1
into v_staff_proxy_user_seq_num
from icmr32dv.staff_proxy_user;
-- create sequence
execute immediate 'create sequence icmr32dv.staff_proxy_user_seq2 minvalue 1 maxvalue 999999999999999999999999999 start with v_staff_proxy_user_seq_num increment by 1 nocache';
end;What is the requirement of creating sequnce dynamically.?
may be you can try this?
execute immediate 'create sequence icmr32dv.staff_proxy_user_seq2 minvalue 1 maxvalue 999999999999999999 start With '|| v_staff_proxy_user_seq_num || ' increment by 1 nocache'; -
Issue with Select Query in the Delivery userexit USEREXIT_SAVE_DOCUMENT
Hi All,
I am facing a strang issue with delivery userexit
1) I have a delivery user exit MV50AFZ1 - USEREXIT_SAVE_DOCUMENT.
2) In this user exit. I have written a select query as shown below
*Get the already delivered data
SELECT vbeln
vgbel
vgpos
erdat
erzet
lfimg
FROM lips
INTO TABLE t_lips
FOR ALL ENTRIES IN t_xlips_reference
WHERE vgbel EQ t_xlips_reference-vgbel
AND vgpos EQ t_xlips_reference-vgpos.
IF sy-subrc EQ 0.
ENDIF.
3) The use of the above select query is to find out if there is any delivery that has already been created for the reference slaes order for which the current delivery is being created.
4) The issue here is that for the FIRST DELIVERY, this select query should fail becuase there is no delivery created earlier and LIPS table would not have data. But, I am seeing some data getting populated in the internal table. The data that I am seeing in the internal table is the data of XLIPS which is nothing but the one that is about to get saved in the database after finishing this userexit.
5) STRANGE Point is that this is working fine in case if I create delivery using the transaction VL01N. But, if I create delivery using VL10A program I am facing this issue.
<< Removed >>
Thanks,
Babu Kilari
Edited by: Rob Burbank on Jun 16, 2010 4:22 PMThen why don't you add
AND vbeln NE likp-vbeln -
Issue with select query for secondary index
Hi all,
I have created a secondary index A on mara table with fields Mandt and Packaging Material Type VHART.
Now i am trying to write a report
Tables : mara.
data : begin of itab occurs 0.
include structure mara.
data : end of itab.
*select * from mara into table itab*
CLIENT SPECIFIED where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Unable to interpret "CLIENT". Possible causes of error: Incorrect spelling or comma error.
if i change to my select query to
*select * from mara into table itab*
where
MANDT = SY-MANDT and
VHART = 'WER'.
I'm getting an error
Without the addition "CLIENT SPECIFIED", you cannot specify the client field "MANDT" in the WHERE condition.
Let me know if iam wrong and we are at 4.6c
ThanksLike I already said, even if you have added the mandt field in the secondary index, there is no need the use it in the select statement.
Let me elaborate on my reply before. If you have created a UNIQUE index, which I don't think you have, then you should include CLIENT in the index. A unique index for a client-dependent table must contain the client field.
Additional info:
The accessing speed does not depend on whether or not an index is defined as a unique index. A unique index is simply a means of defining that certain field combinations of data records in a table are unique.
Even if you have defined a secondary index, this does not automatically mean, that this index is used. This also depends on the database optimizer. The optimizer will determine which index is best and use it. So before transporting this index, you should make sure that the index is used. How to check this, have a look at the link:
[check if index is used|http://help.sap.com/saphelp_nw70/helpdata/EN/cf/21eb3a446011d189700000e8322d00/content.htm]
Edited by: Micky Oestreich on May 13, 2008 10:09 PM -
Hi,
I have a query something like ...
Select ....
where
b.prodname like 'SHAFT GEAR%' or b.prodname like '%FRONT GEAR%' or b.prodname like '%BREAK 4K%'
and
b.prodname like
(select company name from companyms
where <some comdition>
order by 3,6
I am stucking at :
b.prodname like
(select company name from companyms
where <some comdition>
i.e. how do I give select query with like operator.
In above query I want b.prodname like above and those company name for which I am giving condition. Company names are stored in other table and I want to select and use them with like operator.
Thanks.create table stock
prodname varchar2(50)
insert into stock values ('MICRO FRONT PANEL');
insert into stock values ('ZEBRA FRONT SHAFT');
insert into stock values ('KOBRA SHAFT GEAR');
insert into stock values ('T RUBBER TUBES');
insert into stock values ('MICRO TUBES PANELS');
insert into stock values ('HEFT SHAFT GEAR');
SELECT * FROM STOCK;
PRODNAME
MICRO FRONT PANEL
ZEBRA FRONT SHAFT
KOBRA SHAFT GEAR
T RUBBER TUBES
MICRO TUBES PANELS
HEFT SHAFT GEAR
6 rows selected.
create table companyms
company_name varchar2(50)
insert into companyms values ('MICRO');
insert into companyms values ('CHOPRA');
insert into companyms values ('H.P.');
insert into companyms values ('T');
insert into companyms values ('BEST BROTHERS');
insert into companyms values ('FIVE STAR');
SELECT * FROM COMPANYMS;
COMPANY_NAME
MICRO
CHOPRA
H.P.
T
BEST BROTHERS
FIVE STAR
6 rows selected.
Actually I have little big query which have inner join with couple of more tables and suppose query returned me to select those rows who have SHAFT GEAR or FRONT GEAR or BREAK 4K of MICRO or ZEBRO or ABC company.
So, I have query like :
select ...
.... some inner join...
.... some outer join
.... some union
SOME MORE WHERE CLAUSES ... ETC. ETC...
where b.prodname (b means stock table) like 'SHAFT GEAR%' or 'FRONT PANEL%'
FOR MICRO or ZEBRA or ABC company. -
How create HTML-list with hierarchical query?
Hello all!
I have table HIE (name,id,par) with hierarchical structure (par=id)
As sample:
select name
FROM hie
CONNECT BY PRIOR id=par
START WITH par=0
Root
Branch 1
Lief 11
Lief 12
Bracnh 2
I need to create html-list from this table.
How can I select from that table the structured output with TAGs "UL" "LI":
<ul><li>root
<ul>
<li>branch 1
<ul>
<li>lief11</li>
<li>lief12</li>
</ul>
</li></ul>
<ul>
<li>branch 2</li></ul>
</li></ul>
Sql-Guru, please, help!
Message was edited by:
natalia.demidchick
Message was edited by:
natalia.demidchick
Message was edited by:
natalia.demidchick
Message was edited by:
natalia.demidchick
Message was edited by:
natalia.demidchickYes there was a mistake
Try this. It should be good
Processing ...
CREATE TABLE TAB_A AS (
SELECT 'ROOT' AS NAME,1 AS ID,NULL AS PARENT FROM DUAL
UNION ALL
SELECT 'BRANCH1' AS NAME,2 AS ID,1 AS PARENT FROM DUAL
UNION ALL
SELECT 'BRANCH2' AS NAME,3 AS ID,2 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF1' AS NAME,4 AS ID,2 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF2' AS NAME,5 AS ID,2 AS PARENT FROM DUAL
UNION ALL
SELECT 'BRANCH3' AS NAME,6 AS ID,1 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF3' AS NAME,7 AS ID,2 AS PARENT FROM DUAL
UNION ALL
SELECT 'BRANCH5' AS NAME,8 AS ID,1 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF4' AS NAME,9 AS ID,8 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF5' AS NAME,10 AS ID,3 AS PARENT FROM DUAL
UNION ALL
SELECT 'LIEF6' AS NAME,11 AS ID,3 AS PARENT FROM DUAL
Processing ...
SELECT *
FROM TAB_A
Query finished, retrieving results...
NAME ID PARENT
ROOT 1
BRANCH1 2 1
BRANCH2 3 2
LIEF1 4 2
LIEF2 5 2
BRANCH3 6 1
LIEF3 7 2
BRANCH5 8 1
LIEF4 9 8
LIEF5 10 3
LIEF6 11 3
11 row(s) retrieved
Processing ...
CREATE GLOBAL TEMPORARY TABLE TEMP_TAB AS (
SELECT LEVEL AS LV,ROWNUM AS RN,A.*
FROM TAB_A A
WHERE (1=0)
START WITH PARENT IS NULL
CONNECT BY PRIOR ID = PARENT
Processing ...
INSERT INTO TEMP_TAB
SELECT LEVEL AS LV,ROWNUM AS RN,A.*
FROM TAB_A A
START WITH PARENT IS NULL
CONNECT BY PRIOR ID = PARENT
11 row(s) inserted
Processing ...
SELECT *
FROM TEMP_TAB
Query finished, retrieving results...
LV RN NAME ID PARENT
1 1 ROOT 1
2 2 BRANCH1 2 1
3 3 BRANCH2 3 2
4 4 LIEF5 10 3
4 5 LIEF6 11 3
3 6 LIEF1 4 2
3 7 LIEF2 5 2
3 8 LIEF3 7 2
2 9 BRANCH3 6 1
2 10 BRANCH5 8 1
3 11 LIEF4 9 8
11 row(s) retrieved
Processing ...
SELECT --LV,RN,1+(NVL(LAG(LV) OVER ( ORDER BY RN ASC),0)-LV+1) step,
--lead(LV) OVER ( ORDER BY RN ASC NULLS LAST) next_lev,
decode (lv-1,nvl(LAG(LV) OVER ( ORDER BY RN ASC),0),'<UL>','')||
'<LI>'||NAME||'</LI>'||
replace(
RPAD(chr(10),1+(lv-NVL(lead(LV) OVER ( ORDER BY RN ASC),0))*5,'</UL>'),
chr(10),
) AS HTML
FROM TEMP_TAB A
ORDER BY RN ASC
Query finished, retrieving results...
HTML
<UL><LI>ROOT</LI>
<UL><LI>BRANCH1</LI>
<UL><LI>BRANCH2</LI>
<UL><LI>LIEF5</LI>
<LI>LIEF6</LI></UL>
<LI>LIEF1</LI>
<LI>LIEF2</LI>
<LI>LIEF3</LI></UL>
<LI>BRANCH3</LI>
<LI>BRANCH5</LI>
<UL><LI>LIEF4</LI></UL></UL></UL>
11 row(s) retrieved
Processing ...
DROP TABLE TAB_A PURGE
Processing ...
DROP TABLE TEMP_TAB
SELECT LV,RN,1+(NVL(LAG(LV) OVER ( ORDER BY RN ASC),0)-LV+1) step,
lead(LV) OVER ( ORDER BY RN ASC NULLS LAST) next_lev,
decode (lv-1,nvl(LAG(LV) OVER ( ORDER BY RN ASC),0),'<UL>','')||
'<LI>'||NAME||'</LI>'||
replace(
RPAD(chr(10),1+(lv-NVL(lead(LV) OVER ( ORDER BY RN ASC),0))*5,'</UL>'),
chr(10),
) AS HTML
FROM TEMP_TAB A
ORDER BY RN ASC
/Bye Alessandro -
Issue with select query join....
Hello,
I am facing a problem with a select query. I get a message that itab_data is not long enough.
DATA: itab_data like ptrv_head occurs 0 with header line.
SELECT * from PTRV_HEAD
as a inner join PA0002 as b
on a~pernr = b~pernr
inner join PA0001 as c
on a~pernr = c~pernr
INTO TABLE itab_data
where a~PERNR in S_PERNR
and a~REINR in S_TRIP
and a~ZLAND in S_LAND
and a~DATV1 in S_BEGIN
and a~DATB1 in S_END
and b~NACHN in S_FIRST
and b~VORNA in S_LAST
and c~BUKRS in S_BUKRS
and c~KOSTL in S_KOSTL
and c~PERSG in S_EMPGP
and c~PERSK in S_SUBGP
and c~begda in ldbbegda
and c~endda in ldbendda.
Regards,
Jainam.
Edited by: Jainam Shah on Mar 27, 2009 4:13 PM
Edited by: Jainam Shah on Mar 27, 2009 4:13 PMHi,
Try this..
DATA: t_dfies TYPE STANDARD TABLE OF dfies.
DATA: t_fields TYPE STANDARD TABLE OF char40.
DATA: s_dfies TYPE dfies,
s_fields TYPE char40.
* Get the fields
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = 'PTRV_HEAD'
TABLES
dfies_tab = t_dfies[]
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Build the fields to be selected.
LOOP AT t_dfies INTO s_dfies.
CONCATENATE 'A~' s_dfies-fieldname INTO s_fields.
APPEND s_fields TO t_fields.
CLEAR: s_fields.
ENDLOOP.
* Select.
SELECT (t_fields) from PTRV_HEAD
Thanks
Naren -
Wants to create T-Code with QuickViwer query (sqvi)
Dear Experts,
I create query with the help of SQVI (Quick viewer)
How to create t-code of quick view query ?
Thanks,
Farrukh khan
Edited by: farrukh khan on Dec 6, 2010 8:56 AMDear Experts,
Thanks for your all reply's.
What I am saying is that, I created quick View query in SQVI with join tables in DEV.
Query runs fine. Now, I want to create T-code of that query but when I go to SE93 and select transaction name then continue
but system wasn't find quickView query.
I did R&D it says that first quickviewer convert onto sap query then do SE93.
Please tell me how to convert quickview query onto sap query ?
Thanks,
Farrukh khan -
Performance issue with select query and for all entries.
hi,
i have a report to be performance tuned.
the database table has around 20 million entries and 25 fields.
so, the report fetches the distinct values of two fields using one select query.
so, the first select query fetches around 150 entries from the table for 2 fields.
then it applies some logic and eliminates some entries and makes entries around 80-90...
and then it again applies the select query on the same table using for all entries applied on the internal table with 80-90 entries...
in short,
it accesses the same database table twice.
so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
is around 80-90 entries too much for using "for all entries"?
the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
i really cant find the way out...
please help.chinmay kulkarni wrote:Chinmay,
Even though you tried to ask the question with detailed explanation, unfortunately it is still not clear.
It is perfectly fine to access the same database twice. If that is working for you, I don't think there is any need to change the logic. As Rob mentioned, 80 or 8000 records is not a problem in "for all entries" clause.
>
> so, i tried to get the database table in internal table and apply the logic on internal table and delete the unwanted entries.. but it gave me memory dump, and it wont take that huge amount of data into abap memory...
>
It is not clear what you tried to do here. Did you try to bring all 20 million records into an internal table? That will certainly cause the program to short dump with memory shortage.
> the logic that is applied to eliminate the entries from internal table is too long, and hence cannot be converted into where clause to convert it into single select..
>
That is fine. Actually, it is better (performance wise) to do much of the work in ABAP than writing a complex WHERE clause that might bog down the database. -
Hi All,
i_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF.
I am using the above select query.problem is when i put the value
of i_dfkkko-xblnr by going to the table erchc i am getting the record.But this qury is not resulting any value.
i have checked in debug mode copied the value of xblnr of i_dfkkko
and went to erchc table and passed to opbel of erchc i got the reords.
can anybody pls help..
Rgds,
SaiHi,
The database would be having the value with leading zeroes.
Use FM "CONVERSION_EXIT_ALPHA_INPUT" to conver the values & then pass to select query.
_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
loop at i_dfkkko.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
VALUE(INPUT) = i_dfkkko-xblnr
IMPORITNG
VALUE(OUTPUT) = i_dfkkko-xblnr.
modify i_dfkkko.
endloop.
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF.
Maybe you are looking for
-
Server0 yellow: starting apps forever
My server (Sneak preview) was running fine for a couple of weeks until I needed to reboot the machine this morning. Now the server0 process stays yellow for ever. The trace adds a 'ParNew'line every 15 minutes or so. I cannot use the system in this s
-
I am trying to retriew the data report in Excel , but my no of rows exceeding the 250000. So finally unable to take the report , Are there any solutions to get it in Excel or other wise any other reports tools availble to take this type of reports.
-
Hi, I try to share folders with the admin account but I can't. How can I do this ? If I want to share files. I can. Thanks.
-
Hi, I always get the following error. This happens every time I try to use Power Query to import data (even if I try to simply load a local CSV file). I can select the CSV file, or chose the desired online-search data source, but when the data should
-
How to disable 'Stock type' field in MIGO depending doc. type or mvt. type
Does anybody knows how to deactivate (just display but not modify) field 'Stock field' in MIGO transaction if we just want to do that for an specific document type (UB)? If it's not possible, does anybody know how to do that but by movement type (351