oracle - Creating dynamic sql statement -


i'm making package use grants safegaurd, want make search procedure searches rows contain name/value column bellow:

procedure "search"(p_column in varchar2(30), p_value in mytable.{p_column}%type,                     p_refcur out sys_ref_curser) -- variables declaration begin     -- logic validation     open p_refcur         select * mytable {p_column} = p_value; end "search"; 

how can define p_value's type in procedure's signature , create clause column (p_column) variable string.

simply put command quotes. apart should use bind variables.

open p_refcur     'select * mytable '||p_column||' = :val' using p_value; 

and remove curling brackets {}, not used in oracle pl/sql.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -