[quote=”jlchiappa” post=34553]Na verdade, pelo padrão da linguagem SQL trazer o último / maior valor de uma coluna (seja PK ou não) é ** simplesmente ** se pedir um MAX a nível da tabela – por exemplo, na minha tabela DEPT abaixo a PK é a coluna DEPTNO :
scott@BDTESTE:SQL>select * from DEPT order by deptno;
DEPTNO DNAME LOC
——— ————– ————-
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
70 depto 70
80 depto 80
6 linhas selecionadas.
scott@BDTESTE:SQL>
==> basta eu pedir um MAX dessa coluna) :
scott@BDTESTE:SQL>select max(DEPTNO) from DEPT;
MAX(DEPTNO)
———–
80
E é isso ….
[]s
Chiappa[/quote]
Valeu Chiappa… Muito agradecido, mesmo !!!
Grande Abraço.