X-Received: by 10.66.221.42 with SMTP id qb10mr3621726pac.37.1370302963546;
        Mon, 03 Jun 2013 16:42:43 -0700 (PDT)
X-Received: by 10.49.96.8 with SMTP id do8mr1850284qeb.30.1370302963381; Mon,
 03 Jun 2013 16:42:43 -0700 (PDT)
Path: news.cambrium.nl!textnews.cambrium.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!209.85.160.87.MISMATCH!oz11no902451pbb.0!news-out.google.com!bp1ni149pbd.1!nntp.google.com!ch1no549863qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.databases.oracle.server
Date: Mon, 3 Jun 2013 16:42:43 -0700 (PDT)
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=190.124.165.226;
 posting-account=4LHtMgoAAAAJCqzuZgHsSDzT-ApR93Ps
NNTP-Posting-Host: 190.124.165.226
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca236a58-6be0-4ef8-a3c2-797a64d6d7cd@googlegroups.com>
Subject: Dynamic Queries statement
From: Javier Montero <jmontero19@gmail.com>
Injection-Date: Mon, 03 Jun 2013 23:42:43 +0000
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Xref:  news.cambrium.nl

Hello Guys=20

I new in this forum and I have a question about a problem for build a dynam=
ic statement. My problem is when try to run my code from ASP or any app I h=
ave a error, I don't know that is bad in code, please below my PL*SQL. I'm =
not expertise   in oracle but I try.=20
Basically my problem is in the LIKE statement maybe I declared bad this sen=
tence.=20
The common code errors when try to load my query from asp are:
ERROR-ORA-01756
ERROR-ORA-00911
I appreciate your comments and recommendations=20

CREATE OR REPLACE PACKAGE SAME.TESTPGK2 AS=20
TYPE out_cursor IS REF CURSOR;
PROCEDURE T01_PRUEBA2(pp IN VARCHAR2, status IN VARCHAR2, outputCursor OUT =
out_cursor);=20
END TESTPGK2;

CREATE OR REPLACE PACKAGE BODY TESTPGK2 AS
PROCEDURE T01_PRUEBA2(pp IN VARCHAR2, status IN VARCHAR2, outputCursor OUT =
out_cursor)=20
AS

v_query varchar2(8000);

BEGIN=20
        v_query :=3D 'SELECT ID_TYP_ACTOR AS CODIGO, DESCRIPCION AS DESCRIP=
CION, ESTATUS AS ESTATUS FROM T01_TIPOS_ACTORES';
        v_query :=3D v_query || ' WHERE 1 =3D 1';
        IF pp IS NOT NULL THEN=20
            v_query :=3D v_query || ' AND DESCRIPCION LIKE %||pp||% ';
               =20
        END IF;
        IF status IS NOT NULL THEN=20
            v_query :=3D v_query || ' AND ESTATUS LIKE %||status||%' ;
               =20
        END IF;
       v_query :=3D v_query || 'ORDER BY ID_TYP_ACTOR';

OPEN outputCursor for v_query;


EXCEPTION=20
WHEN OTHERS THEN=20
 raise_application_error(-20001, 'An Error was Encountred - ' ||SQLCODE||' =
-ERROR-'||SQLERRM);
END T01_PRUEBA2;
END TESTPGK2;
