Skip to content

Instantly share code, notes, and snippets.

View kllaudyo's full-sized avatar

Claudio Acioli kllaudyo

View GitHub Profile
@kllaudyo
kllaudyo / sample_cursor_in.pls
Created December 3, 2018 17:38
Iterando cursor com "FOR IN"
CREATE OR REPLACE PROCEDURE SAMPLE_CURSOR_IN AS
CURSOR UFS IS
SELECT ID_UF, NM_UF
FROM UNIDADES_FEDERACAO;
BEGIN
FOR J IN UFS
LOOP
CONTENT := '{"sigla":"'|| J.ID_UF ||'","nome":"'|| J.NM_UF ||'"}';
END LOOP;
DBMS_OUTPUT.PUT_LINE(CONTENT);
@kllaudyo
kllaudyo / pagination.sql
Last active January 23, 2019 16:20
Paginação Oracle
select x.*
from (
--aqui dentro vai o seu sql normalmente, com where e etc..
select /*+ FIRST_ROWS(25)*/ --aqui indice de velocidade do próprio oracle
nu_expediente,
row_number() over (order by dt_documento desc, co_seq_documento) rn --ordene pelo que deseja e também por algo único
from tb_documento
) x
where x.rn between 1 and 25 --aqui tu pagina, a pagina dois é 26 and 50
order by x.rn;
declare
rs sys_refcursor;
type result is record(
status char(1),
message varchar2(250)
);
x result;
begin
procedure_returns_sys_ref_cursor(rs_out_parameter, others_parameters);
if rs_out_parameter is not null then
<!--#include file="../util/adovbs.inc"-->
<!--#include file="../util/un_util_objetos.asp"-->
<%
sFileName = "SAP_99999.txt"
Set oFileSystem = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFileSystem.OpenTextFile(Server.MapPath(sFileName), 1, True)
sMailMsg = ""
Do Until oFile.AtEndOfStream
sMailMsg = sMailMsg & oFile.ReadLine
@kllaudyo
kllaudyo / teste.asp
Created March 9, 2020 20:01
Split vbcrlf
<!--#include file="../util/adovbs.inc"-->
<!--#include file="../util/un_util_objetos.asp"-->
<%
sFileName = "SAP_99999.html"
Set oFileSystem = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFileSystem.OpenTextFile(Server.MapPath(sFileName), 1, True)
sMailMsg = ""
Do Until oFile.AtEndOfStream
sMailMsg = sMailMsg & oFile.ReadLine & vbcrlf