Regarding Select query to select only 1000 records in Internal Table.
Hello Friends,
Please explain me to how to Select only 1000 records from data base table?
For Example
SELECT * INTO TABLE ITAB OR SELECT * INTO ITAB
FROM EKKO FROM EKKO
WHERE EBLEN IN S_EBLEN. WHERE EBLEN IN S_EBLEN
(Currently i am using) UP TO 1000 ROWS.
ENDSELECT. (I do not want to use)
In this case Internal table may be store more then 1000 records. But i want to select first 1000 records.
Please explain me.
Regards
Amit
Hi,
TABLES : ekko.
selection-screen begin of block b1 with frame title text_t01.
SELECT-OPTIONS: S_EBELN for ekko-EBELN.
selection-screen end of block b1.
DATA itab TYPE STANDARD TABLE OF ekko.
SELECT *
FROM ekko
INTO TABLE itab
UP TO 1000 ROWS
WHERE EBELN IN S_EBELN.
Thanks,
Sri.
Similar Messages
-
Select query for picking data in a dynamic internal table
Dear All,
Please help.
<u>The code is :</u>
p_table1 = itab_final-tabname1.
p_field1 = itab_final-fieldname1.
SELECT (p_field1) FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <dyntable1>.
It is working fine when the domain is of CHAR
The piece of code is not working where domain is DATS, CURR, DEC, etc.
What shall I do so that it works for other domains also. Please its urgent......
<u>ERROR that came:</u>
An exception occurred. This exception will be dealt with in more detail
below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
caught, which
led to a runtime error. The reason for this exception is:
The data read during a SELECT access could not be inserted into the
target field.
Either conversion is not supported for the target field's type or the
target field is too short to accept the value or the data are not in a
form that the target field can acceptCheck below code
REPORT zpwtest .
*** Tables
DATA: lt_data TYPE REF TO data.
DATA: lt_fieldcatalog TYPE lvc_t_fcat.
data : p_field type string ,
p_table type string .
*** Structure
DATA: ls_fieldcatalog TYPE lvc_s_fcat.
*** Data References
DATA: new_line TYPE REF TO data.
*** Field Symbols
FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
<fs_1> TYPE ANY TABLE,
<fs_2>,
<fs_3>.
ls_fieldcatalog-fieldname = 'MANDT'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CONNID'.
ls_fieldcatalog-inttype = 'N'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'FLDATE'.
ls_fieldcatalog-inttype = 'D'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'PRICE'.
ls_fieldcatalog-inttype = 'P'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ls_fieldcatalog-fieldname = 'CURRENCY'.
ls_fieldcatalog-inttype = 'C'.
APPEND ls_fieldcatalog TO lt_fieldcatalog.
ASSIGN lt_data TO <fs_data>.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_fieldcatalog
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2
IF sy-subrc <> 0.
ENDIF.
*** So <FS_1> now points to our dynamic internal table.
ASSIGN <fs_data>->* TO <fs_1>.
*** Next step is to create a work area for our dynamic internal table.
CREATE DATA new_line LIKE LINE OF <fs_1>.
*** A field-symbol to access that work area
ASSIGN new_line->* TO <fs_2>.
<b>
p_field = 'mandt carrid connid fldate price currency' .
p_table = 'sflight' .
*** And to put the data in the internal table
SELECT (p_field)
FROM (p_table)
INTO CORRESPONDING FIELDS OF TABLE <fs_1>.
</b>
*** Access contents of internal table
LOOP AT <fs_1> ASSIGNING <fs_2>.
ASSIGN COMPONENT 5 OF STRUCTURE <fs_2> TO <fs_3>.
WRITE: / <fs_3>.
ENDLOOP. -
Only first record in internal table in output
Hi,
I have a requirement.
I loop at an internal table and that tabl (list_selected_records) records.
Loop at list_of_selected_nodes into wa_selected_nodes.
node = wa_selected_nodes-node_id.
node_level = wa_selected_nodes-node_level.
read table ex_list_of_texts
into wa_list_of_texts
with key node_id = node
binary search.
IF sy-subrc eq 0.
node_text = wa_list_of_texts-text.
ENDIF.
node_level = node_level - 1.
Selecting Text for Node selected (Business Scenario)
READ TABLE list_of_all_nodes into wa_all_nodes WITH KEY NODE_LEVEL = node_level
BINARY SEARCH.
if sy-subrc = 0.
SELECT SINGLE TEXT FROM TTREET into texts WHERE ID EQ wa_all_nodes-tree_id
AND SPRAS EQ 'EN '.
IF NOT TEXTS IS INITIAL.
wa_final-texts = texts.
append wa_final to it_final.
CLEAR WA_FINAL.
endif.
endif.
endloop.
This is my code.
Now from the select single stmt i fetch a text and add it to be internal table . Once i fetch a one record the loop should be ended and a new iteration for for a second guid should start.
Once one record , first record is fetched for texts, only that shd appear in alv output but not other. but the loop should contnue for other fields. Please help
Thanks in Advance.
SSHi Swarna,
Use control event AT-NEW inside the loop. This event will triger only once for every new node_id.
Loop at list_of_selected_nodes into wa_selected_nodes.
AT-NEW node_id.
node = wa_selected_nodes-node_id.
node_level = wa_selected_nodes-node_level.
read table ex_list_of_texts
into wa_list_of_texts
with key node_id = node
binary search.
IF sy-subrc eq 0.
node_text = wa_list_of_texts-text.
ENDIF.
node_level = node_level - 1.
Selecting Text for Node selected (Business Scenario)
READ TABLE list_of_all_nodes into wa_all_nodes WITH KEY NODE_LEVEL = node_level
BINARY SEARCH.
if sy-subrc = 0.
SELECT SINGLE TEXT FROM TTREET into texts WHERE ID EQ wa_all_nodes-tree_id
AND SPRAS EQ 'EN '.
IF NOT TEXTS IS INITIAL.
wa_final-texts = texts.
append wa_final to it_final.
CLEAR WA_FINAL.
endif.
endif.
ENDAT.
endloop.
Thanks & Regards,
Parameswaran.K -
Limitation that only 1000 records can be included in the "IN" clause
In RapidSQL we have a limitation that only 1000 records can be included in the "IN" clause - is there a way to give more than 1000 records so that it will reduce the execution time.
Why do you need to list more than 1000 individual items in the first place? That's generally not a good way to go about building a query.
You can always include a query that returns as many rows as you'd like in an IN clause, i.e.
SELECT *
FROM some_table
WHERE some_column IN (SELECT some_column FROM some_other_table)So if you throw the thousands of values you want in the IN list into a table, you could then query the table in your IN clause.
From a performance standpoint, of course, you may also want to look at the EXISTS clause depending on the relative data volumes involved.
Justin -
Need help in SQL query to get only distinct records
Hi all.
I am new to oracle SQL and i want to write a query to get only distinct values from 2 tables.
for example i hade 2 tables table1(employee_id,employee_no,grade) and another table2 with same structure.
for example data in table1 is
Employeeid employeeno Grade
1 101 A
1 101 B
1 101 E
1 101 D
and data in table 2 is
Employeeid employeeno Grade
1 101 A
1 101 B
1 101 E
i want to display only the fourth row like the data that doesnt exist in table2 i,e (1 101 D)
I had too much records in both tables and i jst want to see the records that is in table 1 not in table 2 only.
employeeid and employeeno are the same in both tables
I hope u understand my query. I user left outer join and right outer join bt it displays all the results that and matching and unmatching. I want jst unmatched records.
Any help is highly Appreciated.
Thanx in Advance.
I am using oracle 10G on windowsTry MINUS:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries004.htm#i2054381
SQL> -- generating sample data:
SQL> with t1 as (
2 select 1 employeeid, 101 employeeno, 'A' grade from dual union
3 select 1, 101, 'B' from dual union
4 select 1, 101, 'E' from dual union
5 select 1, 101, 'D' from dual
6 )
7 , t2 as (
8 select 1 employeeid, 101 employeeno, 'A' grade from dual union
9 select 1, 101, 'B' from dual union
10 select 1, 101, 'E' from dual
11 )
12 --
13 -- actual query:
14 --
15 select employeeid
16 , employeeno
17 , grade
18 from t1
19 minus
20 select employeeid
21 , employeeno
22 , grade
23 from t2;
EMPLOYEEID EMPLOYEENO G
1 101 D
1 row selected. -
Bulk collect limit 1000 is looping only 1000 records out of 35000 records
In below code I have to loop around 35000 records for every month of the year starting from Aug-2010 to Aug-2011.
I am using bulk collect with limit clause but the problem is:
a: Limit clause is returning only 1000 records.
b: It is taking too much time to process.
CREATE OR REPLACE PACKAGE BODY UDBFINV AS
F UTL_FILE.FILE_TYPE;
PV_SEQ_NO NUMBER(7);
PV_REC_CNT NUMBER(7) := 0;
PV_CRLF VARCHAR2(2) := CHR(13) || CHR(10);
TYPE REC_PART IS RECORD(
PART_NUM PM_PART_HARSH.PART_NUM%TYPE,
ON_HAND_QTY PM_PART_HARSH.ON_HAND_QTY%TYPE,
ENGG_PREFIX PM_PART_HARSH.ENGG_PREFIX%TYPE,
ENGG_BASE PM_PART_HARSH.ENGG_BASE%TYPE,
ENGG_SUFFIX PM_PART_HARSH.ENGG_SUFFIX%TYPE);
TYPE TB_PART IS TABLE OF REC_PART;
TYPE REC_DATE IS RECORD(
START_DATE DATE,
END_DATE DATE);
TYPE TB_MONTH IS TABLE OF REC_DATE;
PROCEDURE MAIN IS
/* To be called in Scheduler Programs Action */
BEGIN
/* Initializing package global variables;*/
IFMAINT.V_PROG_NAME := 'FULL_INVENTORY';
IFMAINT.V_ERR_LOG_TAB := 'UDB_ERR_FINV';
IFMAINT.V_HIST_TAB := 'UDB_HT_FINV';
IFMAINT.V_UTL_DIR_NAME := 'UDB_SEND';
IFMAINT.V_PROG_TYPE := 'S';
IFMAINT.V_IF_TYPE := 'U';
IFMAINT.V_REC_CNT := 0;
IFMAINT.V_DEL_INS := 'Y';
IFMAINT.V_KEY_INFO := NULL;
IFMAINT.V_MSG := NULL;
IFMAINT.V_ORA_MSG := NULL;
IFSMAINT.V_FILE_NUM := IFSMAINT.V_FILE_NUM + 1;
IFMAINT.LOG_ERROR; /*Initialize error log table, delete prev. rows*/
/*End of initialization section*/
IFMAINT.SET_INITIAL_PARAM;
IFMAINT.SET_PROGRAM_PARAM;
IFMAINT.SET_UTL_DIR_PATH;
IFMAINT.GET_DEALER_PARAMETERS;
PV_SEQ_NO := IFSMAINT.GENERATE_FILE_NAME;
IF NOT CHECK_FILE_EXISTS THEN
WRITE_FILE;
END IF;
IF IFMAINT.V_BACKUP_PATH_SEND IS NOT NULL THEN
IFMAINT.COPY_FILE(IFMAINT.V_UTL_DIR_PATH,
IFMAINT.V_FILE_NAME,
IFMAINT.V_BACKUP_PATH_SEND);
END IF;
IFMAINT.MOVE_FILE(IFMAINT.V_UTL_DIR_PATH,
IFMAINT.V_FILE_NAME,
IFMAINT.V_FILE_DEST_PATH);
COMMIT;
EXCEPTION
WHEN IFMAINT.E_TERMINATE THEN
IFMAINT.V_DEL_INS := 'N';
IFMAINT.LOG_ERROR;
ROLLBACK;
UTL_FILE.FCLOSE(F);
IFMAINT.DELETE_FILE(IFMAINT.V_UTL_DIR_PATH, IFMAINT.V_FILE_NAME);
RAISE_APPLICATION_ERROR(IFMAINT.V_USER_ERRCODE, IFMAINT.V_ORA_MSG);
WHEN OTHERS THEN
IFMAINT.V_DEL_INS := 'N';
IFMAINT.V_MSG := 'ERROR IN MAIN PROCEDURE ||IFMAINT.V_PROG_NAME';
IFMAINT.V_ORA_MSG := SUBSTR(SQLERRM, 1, 255);
IFMAINT.V_USER_ERRCODE := -20101;
IFMAINT.LOG_ERROR;
ROLLBACK;
UTL_FILE.FCLOSE(F);
IFMAINT.DELETE_FILE(IFMAINT.V_UTL_DIR_PATH, IFMAINT.V_FILE_NAME);
RAISE_APPLICATION_ERROR(IFMAINT.V_USER_ERRCODE, IFMAINT.V_ORA_MSG);
END;
PROCEDURE WRITE_FILE IS
CURSOR CR_PART IS
SELECT A.PART_NUM, ON_HAND_QTY, ENGG_PREFIX, ENGG_BASE, ENGG_SUFFIX
FROM PM_PART_HARSH A;
lv_cursor TB_PART;
LV_CURR_MONTH NUMBER;
LV_MONTH_1 NUMBER := NULL;
LV_MONTH_2 NUMBER := NULL;
LV_MONTH_3 NUMBER := NULL;
LV_MONTH_4 NUMBER := NULL;
LV_MONTH_5 NUMBER := NULL;
LV_MONTH_6 NUMBER := NULL;
LV_MONTH_7 NUMBER := NULL;
LV_MONTH_8 NUMBER := NULL;
LV_MONTH_9 NUMBER := NULL;
LV_MONTH_10 NUMBER := NULL;
LV_MONTH_11 NUMBER := NULL;
LV_MONTH_12 NUMBER := NULL;
lv_month TB_MONTH := TB_MONTH();
BEGIN
IF CR_PART%ISOPEN THEN
CLOSE CR_PART;
END IF;
FOR K IN 1 .. 12 LOOP
lv_month.EXTEND();
lv_month(k).start_date := ADD_MONTHS(TRUNC(SYSDATE, 'MM'), - (K + 1));
lv_month(k).end_date := (ADD_MONTHS(TRUNC(SYSDATE, 'MM'), -K) - 1);
END LOOP;
F := utl_file.fopen(IFMAINT.V_UTL_DIR_NAME, IFMAINT.V_FILE_NAME, 'W');
IF UTL_FILE.IS_OPEN(F) THEN
/*FILE HEADER*/
utl_file.put_line(F,
RPAD('$CUD-', 5, ' ') ||
RPAD(SUBSTR(IFMAINT.V_PANDA_CD, 1, 5), 5, ' ') ||
RPAD('-136-', 5, ' ') || RPAD('000000', 6, ' ') ||
RPAD('-REDFLEX-KA-', 13, ' ') ||
RPAD('00000000-', 9, ' ') ||
RPAD(IFMAINT.V_CDS_SPEC_REL_NUM, 5, ' ') ||
RPAD('CD', 2, ' ') ||
RPAD(TO_CHAR(SYSDATE, 'MMDDYY'), 6, ' ') ||
LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
RPAD('-', 1, ' ') || RPAD(' ', 9, ' ') ||
RPAD('-', 1, ' ') || RPAD(' ', 17, ' ') ||
RPAD('CD230', 5, ' ') ||
RPAD(TO_CHAR(SYSDATE, 'MMDDYY'), 6, ' ') ||
LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
LPAD(PV_REC_CNT, 8, 0) || RPAD(' ', 5, ' ') ||
RPAD('00000000', 8, ' ') || RPAD('CUD', 3, ' ') ||
RPAD(IFMAINT.V_CDS_SPEC_REL_NUM, 5, ' ') ||
RPAD(IFMAINT.V_GEO_SALES_AREA_CD, 3, ' ') ||
RPAD(IFMAINT.V_FRANCHISE_CD, 2, ' ') ||
RPAD(IFMAINT.V_DSP_REL_NUM, 9, ' ') ||
RPAD('00136REDFLEX', 12, ' ') || RPAD(' ', 1, ' ') ||
RPAD('KA', 2, ' ') || RPAD('000000', 6, ' ') ||
RPAD('00D', 3, ' ') ||
RPAD(IFMAINT.V_VENDOR_ID, 6, ' ') ||
RPAD(IFSMAINT.V_FILE_TYPE, 1, ' ') ||
RPAD('>', 1, ' ') || PV_CRLF);
/*LINE ITEMS*/
OPEN CR_PART;
FETCH CR_PART BULK COLLECT
INTO lv_cursor limit 1000;
FOR I IN lv_cursor.FIRST .. lv_cursor.LAST LOOP
SELECT SUM(A.BILL_QTY)
INTO LV_CURR_MONTH
FROM PD_ISSUE A, PH_ISSUE B
WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
AND A.DOC_NUM = B.DOC_NUM
AND B.DOC_DATE BETWEEN TRUNC(SYSDATE, 'MM') AND SYSDATE
AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
FOR J IN 1 .. 12 LOOP
SELECT SUM(A.BILL_QTY)
INTO LV_MONTH_1
FROM PD_ISSUE A, PH_ISSUE B
WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
AND A.DOC_NUM = B.DOC_NUM
AND B.DOC_DATE BETWEEN lv_month(J).start_date and lv_month(J)
.end_date
AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
END LOOP;
utl_file.put_line(F,
RPAD('IL', 2, ' ') ||
RPAD(TO_CHAR(SYSDATE, 'RRRRMMDD'), 8, ' ') ||
RPAD(LV_CURSOR(I).ENGG_PREFIX, 6, ' ') ||
RPAD(LV_CURSOR(I).ENGG_BASE, 8, ' ') ||
RPAD(LV_CURSOR(I).ENGG_SUFFIX, 6, ' ') ||
LPAD(LV_CURSOR(I).ON_HAND_QTY, 7, 0) ||
LPAD(NVL(LV_CURR_MONTH, 0), 7, 0) ||
LPAD(LV_MONTH_1, 7, 0) || LPAD(LV_MONTH_2, 7, 0) ||
LPAD(LV_MONTH_3, 7, 0) || LPAD(LV_MONTH_4, 7, 0) ||
LPAD(LV_MONTH_5, 7, 0) || LPAD(LV_MONTH_6, 7, 0) ||
LPAD(LV_MONTH_7, 7, 0) || LPAD(LV_MONTH_8, 7, 0) ||
LPAD(LV_MONTH_9, 7, 0) || LPAD(LV_MONTH_10, 7, 0) ||
LPAD(LV_MONTH_11, 7, 0) ||
LPAD(LV_MONTH_12, 7, 0));
IFMAINT.V_REC_CNT := IFMAINT.V_REC_CNT + 1;
END LOOP;
CLOSE CR_PART;
/*TRAILER*/
utl_file.put_line(F,
RPAD('$EOF-', 5, ' ') || RPAD('320R', 4, ' ') ||
RPAD(SUBSTR(IFMAINT.V_PANDA_CD, 1, 5), 5, ' ') ||
RPAD(' ', 5, ' ') ||
RPAD(IFMAINT.V_GEO_SALES_AREA_CD, 3, ' ') ||
RPAD(TO_CHAR(SYSDATE, 'MM-DD-RR'), 6, ' ') ||
LPAD(IFSMAINT.V_FILE_NUM, 2, 0) ||
LPAD(IFMAINT.V_REC_CNT, 8, 0) || 'H' || '>' ||
IFMAINT.V_REC_CNT);
utl_file.fclose(F);
IFMAINT.INSERT_HISTORY;
END IF;
END;
FUNCTION CHECK_FILE_EXISTS RETURN BOOLEAN IS
LB_FILE_EXIST BOOLEAN := FALSE;
LN_FILE_LENGTH NUMBER;
LN_BLOCK_SIZE NUMBER;
BEGIN
UTL_FILE.FGETATTR(IFMAINT.V_UTL_DIR_NAME,
IFMAINT.V_FILE_NAME,
LB_FILE_EXIST,
LN_FILE_LENGTH,
LN_BLOCK_SIZE);
IF LB_FILE_EXIST THEN
RETURN TRUE;
END IF;
RETURN FALSE;
EXCEPTION
WHEN OTHERS THEN
RETURN FALSE;
END;
END;Try this:
OPEN CR_PART;
loop
FETCH CR_PART BULK COLLECT
INTO lv_cursor limit 1000;
exit when CR_PART%notfound;
FOR I IN lv_cursor.FIRST .. lv_cursor.LAST LOOP
SELECT SUM(A.BILL_QTY)
INTO LV_CURR_MONTH
FROM PD_ISSUE A, PH_ISSUE B
WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
AND A.DOC_NUM = B.DOC_NUM
AND B.DOC_DATE BETWEEN TRUNC(SYSDATE, 'MM') AND SYSDATE
AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
FOR J IN 1 .. 12 LOOP
SELECT SUM(A.BILL_QTY)
INTO LV_MONTH_1
FROM PD_ISSUE A, PH_ISSUE B
WHERE A.DOC_TYPE IN ('CRI', 'RRI', 'RSI', 'CSI')
AND A.DOC_NUM = B.DOC_NUM
AND B.DOC_DATE BETWEEN lv_month(J).start_date and lv_month(J)
.end_date
AND A.PART_NUM = LV_CURSOR(i).PART_NUM;
END LOOP;
utl_file.put_line(F,
RPAD('IL', 2, ' ') ||
RPAD(TO_CHAR(SYSDATE, 'RRRRMMDD'), 8, ' ') ||
RPAD(LV_CURSOR(I).ENGG_PREFIX, 6, ' ') ||
RPAD(LV_CURSOR(I).ENGG_BASE, 8, ' ') ||
RPAD(LV_CURSOR(I).ENGG_SUFFIX, 6, ' ') ||
LPAD(LV_CURSOR(I).ON_HAND_QTY, 7, 0) ||
LPAD(NVL(LV_CURR_MONTH, 0), 7, 0) ||
LPAD(LV_MONTH_1, 7, 0) || LPAD(LV_MONTH_2, 7, 0) ||
LPAD(LV_MONTH_3, 7, 0) || LPAD(LV_MONTH_4, 7, 0) ||
LPAD(LV_MONTH_5, 7, 0) || LPAD(LV_MONTH_6, 7, 0) ||
LPAD(LV_MONTH_7, 7, 0) || LPAD(LV_MONTH_8, 7, 0) ||
LPAD(LV_MONTH_9, 7, 0) || LPAD(LV_MONTH_10, 7, 0) ||
LPAD(LV_MONTH_11, 7, 0) ||
LPAD(LV_MONTH_12, 7, 0));
IFMAINT.V_REC_CNT := IFMAINT.V_REC_CNT + 1;
END LOOP;
end loop;
CLOSE CR_PART; -
RetrieveLimitedRecordsCommand retrieving only 1000 records
Hi All,
While I am trying to retrieve records from the main table using RetrieveLimitedRecordsCommand I am getting only 1000 records from MDM, where as there are around 100000 records in the table.
Could anyone help in this regard.
Thanks and Regards,
SubhasisThe default page size is set to 1000, so if you have more than 1000 records, customize your code to increase the page size in loop.
Here is how we did:
Get the count total records = n //use the method getSearchTableMatchCount() on RetrieveLimitedRecordsExCommand
int n = retrieveLimitedRecordsExCommand.getSearchTableMatchCount( ) ;
Number of pages or Page size p
int p = N / 1000 ;
for( int i=1; i<=p ; i++ )
//Now loop through the retrieve command from 1 to p and inside the loop take the records in an array.
Now either you can implement it this way to get all the records in one shot. Or you can implement custom pagination on your table/result set view to retrieve the next 1000 records as required.
And if you implement your custom pagination, you can also set the page size as per your design.
Regards
Nitin -
I can get video on airplay anytime but i cannot get audio all the time. in sound output i select airplay but it only reverts back to internal speakers. same if i try earbuds. the only way to fix it is to restart computer. what do i do to fix it,
In case anyone has had the same problem as me, I have just managed to fix this by doing the following:
Switch off Mac
Switch back on in Safe Mode (Hit power button, then hold Shift key until a loading bar appears at the bottom of the screen).
Switch off Mac again
Remove power cord and wait 15 seconds
Plug power cord back in and hold down the keys alt, cmd, p, r all at the same time until you hear Starting chime for a second time and hopefully your audio will back. -
Make this select query to Select Insert query
Hi,
How to make this select query to select Insert query..
;WITH DateDim AS
SELECT CAST('1900-01-01' AS DATETIME) StartDate
UNION ALL
SELECT StartDate + 1
FROM DateDim
WHERE StartDate + 1 <= '2099-12-31'
SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
, StartDate
, DATEPART(dw, StartDate) AS DayNumberOfWeek
, DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
, DAY(StartDate) AS DayNumberOfMonth
, (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
FROM DateDim
OPTION (MAXRECURSION 0)
GOThe final solution is
;WITH DateDim AS
SELECT CAST('1900-01-01' AS DATETIME) StartDate
UNION ALL
SELECT StartDate + 1
FROM DateDim
WHERE StartDate + 1 <= '2099-12-31'
SELECT CAST(CONVERT(CHAR(8),CAST(StartDate AS DATETIME),112) AS INT) AS DateKey
, StartDate
, DATEPART(dw, StartDate) AS DayNumberOfWeek
, DATENAME(dw, StartDate) AS EnglishDayNameOfWeek
, DAY(StartDate) AS DayNumberOfMonth
, (CASE WHEN MONTH(StartDate)>=1 AND MONTH(StartDate) <=6 THEN 1 ELSE 2 END) AS CalendarSemester
Into new_tablenameFROM
DateDim
OPTION (MAXRECURSION 0)
GO -
SQL query to get last 10 records in the table?
Hi,
Can anyone tell me the SQL query to get last 10 records in the table?
Thanks!!
MCPPlease, define what "last" means. Sets are unordered by definition, so if you want to retrieve rows from a table in a specific order you need to specify what that order is - e.g. by maintaining a value in a column (or a combination of columns) that you can use in the ORDER BY clause of the SELECT statement.
If, for instance, you kept the time when the row was inserted in a special column (InsertedTime), you could use this in your query like this:
select top (10)
<column list>
from <table or view>
where <restriction(s)>
order by InsertedTime desc;
ML
Matija Lah, SQL Server MVP
http://milambda.blogspot.com -
How To select maximum Value in a specifieid field in internal table.
How To select maximum Value in a specifieid field in internal table?
Step : 1
Sort itab by <Field1> descending.
Just sort the internal table by the field.
STEP: 2
Then read the table at index 1.
Read table itab index 1.
ITAB-FIELD = MAX . " Max field will come in the first row of the internal table.
Regards,
Gurpreet -
How to update Records from Internal table to u2018Zu2019 table?
Hi Friends,
How to update Records from Internal table to u2018Zu2019 table.
I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
( my internal table & u2018 Zu2019 table structures are same.)
Thanking you.
Regards,
SubashHi,
loop at internal table.
modify <Z- table > from values < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
endloop.
or
UPDATE <Z- table > from table < internal table Workarea>.
if sy-subrc = 0.
COMMIT work.
else.
ROLLBACK waork.
endif.
Prabhudas -
Inserting records from internal table to database table
Hi all,
i want to insert records from internal table to zDatabase table, can u plz guide me which statement is better in performance to insert the records.
1) insert one by one record from internal table
loop at itab.
insert ztable from wa.
endloop.
2) insert total records at a time
INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or let me know if any other statement is there with high performance.
i internal table contains nearly 40000 records.
thanks.Hi,
Insert the entire table at atime rather than a record so as to increase the performance.
you can use INSERT <dbtabname> CLIENT SPECIFIED FROM TABLE itab.
or
MODIFY ZPRODUCT FROM TABLE GI_AFPO.
Regards,
Raj. -
To delete duplicate records from internal table
hi friends,
i have to delete records from internal table based on following criterion.
total fields are 7.
out of which if 4 fields are same and 5th field is different,then both records must be deleted.
in case all five fields are same,the program should do nothing.
for example.
if there are 3 records as follows
a1 b1 c1 d1 e1 f g
a1 b1 c1 d1 e2 w r
a1 b1 c1 d1 e1 j l
then first two records should be deleted as four fields are same but fifth(e) field differs.
but third record should remain as it is evenif first five fields are same for first and third record.
values of last two fields need not to be consider for deleting the records.LOOP AT ITAB.
V_FILED5 = ITAB-F5. "to compare later
V_TABIX = SY-TABIX. "used to delete if condition not matches
READ TABLE ITAB WITH KEY F1 = ITAB-F1
F2 = ITAB-F2
F3 = ITAB-F3
F4 = ITAB-F4.
IF SY-SUBRC = 0.
IF ITAB-F5 <> V_FIELD5.
*--both the records to be deleted,as Field5 is different.
DELETE ITAB INDEX SY-TABIX. "deletes that record
DELETE ITAB INDEX V_TABIX. "deletes the current record
ENDIF.
ENDIF.
ENDLOOP.
Message was edited by: Srikanth Kidambi
added comments
Message was edited by: Srikanth Kidambi -
SQL select query having more than 1000 values in 'IN' clause of predicate.
Hi,
We are executing a select query from a table and showing it through a front end screen. When the count of values given in the 'IN' clause of predicate are exceeding 1000 , it is throwing error.
eg. select * from Employees where emp.Id. in('111',123','121','3232',........1001 Ids)
We are using Oracle version 10.2.0.
Please suggest how to tackle such issue.
Regards,
Naveen Kumar.C.
Edited by: Naveen Kumar C on Aug 30, 2008 10:01 PMUse a nested table:
create or replace type numbertype
as object
(nr number(20,10) )
create or replace type number_table
as table of numbertype
create or replace procedure tableselect
( p_numbers in number_table
, p_ref_result out sys_refcursor)
is
begin
open p_ref_result for
select *
{noformat} from employees
, (select /*+ cardinality(tab 10) */ tab.nr
from table(p_numbers) tab) tbnrs
where id = tbnrs.nr;
end;
/{noformat}
Using nested tables will reduce the amount of parsing because the sql statement uses binded variables! The cardinality hint causes Oracle to use the index on employees.id.
Maybe you are looking for
-
Computer won't reconize iPod(Yet it still works fine as an iPod)
I have a 5.5 gen 80GB iPod, and it's always worked fine(Even through multiple attempts at using iPod Linux and Rockbox). Last night I go and plug it in to my Linux laptop, worked fine for what I used it for(just getting to files I had saved on it), a
-
0FI_AR_4 Initialization - millions of records
Hi, We are planning to initialize 0FI_AR_4 datasource for which there are millions of records available in Source system. While checking in Quality system we have realised that just for a single fiscal period it is taking hours to extract data, and i
-
Risk violations count in GRC 10
Recently AC 10 has gone live, and we run the risk violations reports in the Access dashboard. It shows the reports according to teh Business Process and the value is very high, like violations count - 121099 for MM00. But when we run the risk analysi
-
HELP: Error while insert in master-detail form!!!
Hello I have created a master-detail form and when I tried to insert a new record I got an error that the field on the detail table that references the primary key on the master table can not be null. I don't understand this error because I thought t
-
I can't see my photo or image in a large size (zoom)
I have Photo's Album in Facebook; when I want to look in a large size one by one, I can't to do it