Task: there are 100 entries in the table (rating by points). It is necessary to display 7 records with points, where the 4th line is usr_id in the select, 1 2 3 - records in which there are more points than the 4 lines and 5 6 7 records, where the points are less than the 4 lines.
In the report you need to display, highlighted by a frame, starting from the 13th line. I try to make a report using a temporary table, but nothing comes out (with an select, an error occurs).
declare rn decimal(10) DECLARE LOCAL TEMPORARY TABLE table1 (point_group varchar(10), point_code varchar(10), point_name varchar(10), USR_ID varchar(10, fio varchar(10), ball int, zball int, rn int) begin insert into table1 select point_group, point_code, point_name, USR_ID, FIO, BALL, ZBALL, rownum() over (order by ball desc) as rn from a3_user_rating_new01 select rn = rn from table1 where USR_ID = 371 select * from table1 where rn between (rn-3) and (rn+3) Error text: Error starting at line: 45 in command - declare rn decimal (10)
DECLARE LOCAL TEMPORARY TABLE table1 (point_group varchar (10), point_code varchar (10), point_name varchar (10), USR_ID varchar (10, fio varchar (10), ball int, zball int, rn int)
begin
insert into table1 select point_group, point_code, point_name, USR_ID, FIO, BALL, ZBALL, rownum () over (order by ball desc) as rn from a3_user_rating_new01
select rn = rn from table1 where USR_ID = 371 select * from table1 where rn between (rn-3) and (rn + 3) Error report - ORA-06550: line 3, column 1: PLS-00103: Encountered the symbol "DECLARE "when expecting one of the following:
: =; not null default character 06550. 00000 - "line% s, column% s: \ n% s" * Cause: Usually a PL / SQL compilation error. * Action:
select rn = rn from table1 where USR_ID = 371should most likely be thisselect rn into rn from table1 where USR_ID = 371. In general, it is better to provide the data, I do not believe that we need a temporary table here - Mike