function for SPV

Please help me below function for SPV
create or replace function vpd_fcn (vpd_schema varchar2, vpd_object varchar2)
return varchar2
is
v_user varchar2(50);
Predicate varchar2(2000);
begin
v_user :=   SYS_CONTEXT('USERENV', 'SESSION_USER');
if (v_user = 'KRZYSZTOF') then
Predicate := NULL;
else
Predicate := 'USERREG = ''v_user'';
end if;
return Predicate;
end;
/
Line > > predicate: = ' USERREG = "v_user"; < < how to declare this line with varialbe VPD v_user.


Thank you.
Concerning
Krzysztof

Maybe you want to concat:
your example:

SQL> create or replace function vpd_fcn (vpd_schema varchar2, vpd_object varchar2)
  2  return varchar2
  3  is
  4  v_user varchar2(50);
  5  Predicate varchar2(2000);
  6  begin
  7  v_user :=   SYS_CONTEXT('USERENV', 'SESSION_USER');
  8  if (v_user = 'KRZYSZTOF') then
  9  Predicate := NULL;
 10  else
 11  Predicate := 'USERREG = ''v_user'';
 12  end if;
 13  return Predicate;
 14  end;
 15  /

Warning: Function created with compilation errors.

SQL> sho err
Errors for FUNCTION VPD_FCN:

LINE/COL ERROR
-------- -----------------------------------------------------------------
11/14    PLS-00103: Encountered the symbol "USERREG = 'v_user';
         end if;
         return Predicate;
         end;" when expecting one of the following:
         ( - + case mod new not null 
          
         continue avg count current exists max min prior sql stddev
         sum variance execute forall merge time timestamp interval
         date 
           pipe
         

Adjusted:

SQL> create or replace function vpd_fcn (vpd_schema varchar2, vpd_object varchar2)
  2  return varchar2
  3  is
  4  v_user varchar2(50);
  5  Predicate varchar2(2000);
  6  begin
  7  v_user :=   SYS_CONTEXT('USERENV', 'SESSION_USER');
  8  if (v_user = 'KRZYSZTOF') then
  9  Predicate := NULL;
 10  else
 11  Predicate := 'USERREG = '''||v_user||''' ';
 12  end if;
 13  return Predicate;
 14  end;
 15  /

Function created.

SQL> select vpd_fcn(null,null) from dual;

VPD_FCN(NULL,NULL)
--------------------------------------------------------------------------------
USERREG = 'HOEK'

1 row selected.

Tags: Database

Similar Questions

  • How can I do a quick preview (thumbnails?) of all open tabs in a window (Safari has a function for the display of open tabs)?

    How can I do a quick preview (thumbnails?) of all open tabs in a window (Safari has a function for the display of open tabs)?

    Maybe look into this extension instead:

  • What happened to the 'Reply' function for e-mail messages? How to do that now?

    The new Firefox is not easy to use. The former had the possibilities of action listed for easy access. Now, we have to hit a drop down selection menu that adds additional steps to perform the desired actions. There is also no place that allows the 'Reply' function for messages. Why is it that were eliminated?
    Experts in software, why they do things easier when everything they do is complicate its use for common people?

    Thank you. It was the answer to the problem. Why must it be grounded if secretly for novices must go through this process to get assistance to the fulfilment of the tasks? I know that's not your problem, what the site does, but I'm glad that you were able to help me and solve the problem.
    Thanks again for your expertise.

  • Satellite Z830-10W - timer function for the backlight on the keyboard

    Hey, I bought a Toshiba Satellite Z830-10W, that's a fine ultrabook.
    But I would like to have the timer function for backlight the keyboard work.

    The next update of the BIOS are change? Flemming regand

    Don t think that this feature is available
    Never seen any Toshiba laptop, including such meter for the backlight keys.

  • Jerky mouse mouseover function for all while the menu (file, options, help) and the key back/forward/home too. More scrolling is choppy every Web site.

    Jerky mouse mouseover function for all while the menu (file, options, help) and the key back/forward/home too. More scrolling is choppy every Web site since the update to version 3.6 to 4 RC1.

    Gel mouse pointer when it comes across objects that use some sort of animation or gradual highlighting when hovering on (which is basically all the Firefox 4 items menu, tabs, etc.) But also a lot of things on the Web pages as the green buttons on this page that change color when you hover over them).

    After rebooting my system, however, the problem seems to have disappeared!

    [, WinXP SP3 - 4 GB RAM, Core i5 M520, driver Nvidia NVS3100M 6.14.12.5738, Firefox 4.0]

  • A password works for all functions, for example, to connect to this forum?

    4, 32 MB, iOS 9.2, are different passwords required for different functions, for example, by accessing this forum on iPad?  I suspect that I am the problem, but I follow tangle in passwords,.

    the password log in here is appleId password

  • (1) is there a function for all the object of the same size?

    (1) is there a function for all the object of the same size?

    Sorry, I thought you wanted to align the objects.

    We do not have the function to make items of the same size. You must change one by one. To change the .lks file may be more effective.

  • BSOD network, related function for Winsock problem driver-related

    I'll give as much detail as possible in order to get the right answer.

    I'm working on HP G70 - 463CL with Vista Home Premium 64 - bit.

    The problem is that whenever we try to use something that would require a network function, I have a BSOD with the IRQL_NOT_LESS_OR_EQUAL.
    This occurs even if I plug in a network cable, try to run a web browser, or right-click on the signal wireless in the bottom task bar.

    When the computer reboots, I get the "Windows has recovered from an unexpected shutdown' with this information.
    Problem event name: BlueScreen
    The system version: 6.0.6002.2.2.0.768.3
    LocaleID: 1033

    More information about the problem:
    BCCode: a
    BCP1: 0000000000000000
    BCP2: 0000000000000002
    BCP3: 0000000000000001
    BCP4: FFFFF80002228C45
    OS version: 6_0_6002
    Service Pack: 2_0
    Product: 768_1

    He then lists the minidump file which I do not know how to open it.

    I went to HP and download the current network for the WLAN and LAN drivers. (I have uninstall the previous)

    I went to Services to see what didn't work and I got these errors when I tried to start them.

    The DHCP Client 1.) -Error 1068: the dependency service or group could start. So I clicked on the dependencies and seen that it relies on the "accessory function for Winsock driver" and the "WinHTTP Web Proxy Auto - Discovery Service" depends on DHCP.

    TCP/IP NetBIOS Helper 2 properties.) -a had the same message according to the 'related function pilot' and it depends on the NETBT.

    I have passed to the command window and tried ping 192.168.1.1, and got the error that transmit failed, error code 1231.

    I have also reset IP address and with the command netsh winsock

    I went to Device Manager and click on devices show hidden.

    Under the pilot no Plug and Play there was a yellow by 'Related function for Winsock driver' symbol when I click Properties, it says under the status it is not working properly or has not all the drivers installed (Code 24).
    I also had a yellow symbol of security processor Loader driver and the same information under properties.

    In searching the Internet, I tried several different things that I found and tried including change something in the registry.  At one point I was able to make wireless work and managed to get on the internet and ran Windows Update and downloaded several items.  After the reboot, I clicked on an Internet Explorer icon on the screen to come back on the internet and I got the blue screen again.

    I ran Malwarebytes and it found nothing.

    I uninstalled AVG 8.5 and was going to install a different virus protection and I have a feeling that this is where the problem started.

    So if anyone can offer help, I'd appreciate it.  I have a feeling that everything hinges on the related function driver but do not know how to reinstall.  The hard drive has a recovery partition, but I don't want to reinstall the OS.

    There are a few issues, including the duplicate property and lack of records relating to the CPU.

    While this can be traced back to file by file, the best way to solve the OS when SFC finds files that it cannot solve is to do a repair of the DVD of the OS installation.

  • Spectrum X 360: Function for the spectrum x 360 keys

    The arrows with the function key act as page, up, down, start and end. I want to use these keys a lot. Is there a way to set the keyboard for functions are reversed? On my Mac, I can by default the function for on button. Such a feature would make page upward, active down without the function key and the active arrows with the function key.

    Thank you very much for the comments and you are right that to access the function keys on the arrow key you will need to hold down the FN key.

    If I hear of a different method on changing these options with the arrow keys will let you know.

  • Disable the column key functional for an individual of forms

    Hi all

    I have a block of multiple registration details in my form with fields (type, point, wt, vehicle number etc.). Keys are already scheduled for functional use as f3 to copy.

    In my form, I want to use the copy function to get to the fields as type, point, wt, but not for the vehicle number column. IE type, point, maybe same wt columns but number of vehicle may not be same (according to customer requirement). They will not accidentally copying the same number of vehicle.

    For this I need to disable the copy (F3) function for this vehicle only number column.

    Is there a workaround for this...

    My version of the form is 10g

    Thanks in advance

    Concerning

    JaKes

    the KEY-F3-trigger has nothing to do with the F3 function key. In client-server F3 is associated with the DUPLICATE_ITEM function, so you should use the KEY-DUPITM-trigger.

    Also, if you implement a release BUTTON, it replaces the functionality by default, so you must manage the service for yourself.

    As for the OP functionality should just be deleted at one, the simplest solution is to create KEY-DUPITM-relaxation so precise and simple insert a value that is NULL. inside.

  • How to know the name (package, procedures or functions) for current sessions

    Hi all

    I am DBA and I want to find a way to get the object name regardless (packages, procedures or functions) for the current statement running in the current session.

    To specify when I open the browser session of Toad, I can see the active sessions and the current statement for each session, but without the name of the object.


    Is it possible to know this point.

    Thanks in advance

    Select *.

    from dba_objects

    When object_id in (select nvl (t.PLSQL_ENTRY_OBJECT_ID-1)

    v $ session t

    where sid = 452)

    -----

    Ramin Hashimzade

  • can I use create valude function for MSSql scalar and table.

    Hello

    (1) can I use create scalar function for MSSql and function table?
    (2) is there how many type of function defined by the user in oracle 11 g express?
    (3) and I can reture 'type' any form user defined function?


    Attract sincerely

    944768 wrote:

    the answer lies in a few cases only,

    The response illustrates the basic concept of how customers need to use cursors created using PL/SQL as a layer of abstraction - SQL and this concepts adapts to ALL cases where the customer wants to Oracle via PL/SQL cursor.

    a case is,
    If my function returns only a single value, then I can use oracle 'create function' with the return type as types predefined as a whole, varchar2 etc?
    with regard to performance.

    With regard to this performance problem? And why now suddenly change the question to want to use a function to return data type number or string? How does this relate to PL/SQL to return a cursor now?

    A function can return scalar values, not scalar. A function may return atomic values (such as a unique number, or a non-scalar list of numbers). A function can return a complex data structure consisting of scalar values, not scalar.

    However, in PL/SQL function must NOT be used to read the lines of the database to cache lines in a memory of the server PL/SQL (PGA), then back to the client.

    He does not. It does not fit. It is too bloody dangerous to the overall health of the server as such code plays silly blighters with very expensive server memory.

    A PL/SQL function can also be used as guideline, returning data via expensive PGA, but via the SQL engine instead and using its slider interface (which allows output data to be "gradual" and not to return all data with a single copy of croustilleur mass of the call stack) directly. IT IS, HOWEVER, AN EXCEPTION. There is very rarely the need to make the functions PL/SQL pipeline table - and is often victims of abuse and bad demonstrated with examples of absurd code here.

  • Creating shadows of text - is there a function for this?

    I would like to create a shadow effect for my text in my headers.  Is there a function for this?

    In the current version of Muse you can only apply effects to pixelated fonts (fonts). If you need a shadow to the other fonts effect, you can do the following:

    1. create a paragraph style, name it as you need (for example shadow_paragraph) and assign to the text element you need to be affixed.

    2. go in the Page Properties > metadata > HTML customized to(Or insert HTML to a master page)

    3 insert a

  • How to write the function for bottom of logic...

    I have a picture in the picture I have a records like below
    code value
    1 20
    2 null
    3 30
    4 null
    5 40
    6 null


    The output need to have the values displayed in the fields first, followed by the NULL values as below

    code value
    1 20
    2 30
    3 40
    4 null
    5 null
    6 null

    I think the suspicion is that the values must be concatenated with the replacement of NULL values with (;).
    as
    20, 30, 40
    Get single values and insert into the table...

    for this I don't know how to write function for who can please help me on these...

    Published by: Claudia on June 22, 2011 22:45

    Published by: Claudia on June 22, 2011 22:51

    Create or replace function test_fun
    is
    cursor fun1 is the value select from table by CSA 2;-"this select query will return 20,30,40, null, null, null".
    v_out varchar2 (20);
    Start
    fun1 open cursor;
    loop
    extract the fun1 in v_out;
    dbms_output.put_line (v_out); - this is the command display output on the screen.
    output when fun1 not found %;
    end loop;
    close;
    end;

    Please try it and tell us if no query...

    Thank you
    IQ

  • Create function for ODD or EVEN (NUMBER) in pls sql

    Create the function for ODD or EVEN (NUMBER) also
    If number is odd, multiply by 5
    If there is an even number, multiply it by 10;

    865253 wrote:
    Create the function for ODD or EVEN (NUMBER) also
    If number is odd, multiply by 5
    If there is an even number, multiply it by 10;

    create function fn_get_no (n_in in number) return number is
    o_num number;
    begin
    if mod(n_in,2) = 0 then
    o_num := n_in*10;
    else
    o_num := n_in*5;
    end if;
    return o_num;
    end;
    
    select fn_get_no(5) odd, fn_get_no(4) even from dual;
    ODD EVEN
    25 40 
    

    Vivek L

Maybe you are looking for