skeleton for this need

With the help of dynamic
Creating a procedure with three parameters p_colname varchar2, varchar2, p_ref ref_cursor p_value emp_data

Based on the value in the p_colname and the emp table p_value query and return the result set in a cursor.

Validate the value of the p_colname, you need a valid column_name in emp table

can u give the skeleton for that... I'm nt get how to REF Cursor as a parameter

skeleton for this need

almost all of the body ;):

SQL> create or replace procedure emp_data (p_colname varchar2, p_value varchar2,
p_ref out sys_refcursor)
as
   p_cnt integer := 0;
begin
   select count ( * )
     into p_cnt
     from cols
    where table_name = 'EMP' and column_name = upper (p_colname);

   if p_cnt = 1
   then
      open p_ref for
         'select ' || p_colname || ' from emp where ' || p_colname || ' = :1'
         using p_value;
   else
      raise_application_error (-20003,
      'Column ' || p_colname || ' does not exist');
   end if;
end emp_data;
/
Procedure created.

SQL> var c refcursor

SQL> exec emp_data('eame', 'SCOTT',:c)
BEGIN emp_data('eame', 'SCOTT',:c); END;
Error at line 27
ORA-20003: Column eame does not exist
ORA-06512: at "MICHAEL.EMP_DATA", line 17
ORA-06512: at line 1

SQL> exec emp_data('ename', 'SCOTT',:c)
PL/SQL procedure successfully completed.
SQL> print

ENAME
----------
SCOTT
1 row selected.

Tags: Database

Similar Questions

  • Oracle's solution for this need for specific research.

    Hello

    We are on Oracle 11.2.0.2 on Solaris 10. We need to be able to search on data that have diacritics and we should be able to make the serach ignoring this diacritical. That is the requirement. Now, I could hear that Oracle Text has a preference called BASIC_LEXER which can ignore diacritics and so only this feature I implemented Oracle Text and just for this DIACRITIC search and no other need.

    I mean I put up preferably like this:
      ctxsys.ctx_ddl.create_preference ('cust_lexer', 'BASIC_LEXER');
      ctxsys.ctx_ddl.set_attribute ('cust_lexer', 'base_letter', 'YES'); -- removes diacritics
    
    
    With this I set up like this:
    
    CREATE TABLE TEXT_TEST
    (
      NAME  VARCHAR2(255 BYTE)
    );
    
    --created Oracle Text index
    
    CREATE INDEX TEXT_TEST_IDX1 ON TEXT_TEST
    (NAME)
    INDEXTYPE IS CTXSYS.CONTEXT
    PARAMETERS('LEXER cust_lexer WORDLIST cust_wl SYNC (ON COMMIT)');
    --sample data to illustrate the problem
    
    Insert into TEXT_TEST
       (NAME)
     Values
       ('muller');
    Insert into TEXT_TEST
       (NAME)
     Values
       ('müller');
    Insert into TEXT_TEST
       (NAME)
     Values
       ('MULLER');
    Insert into TEXT_TEST
       (NAME)
     Values
       ('MÜLLER');
    Insert into TEXT_TEST
       (NAME)
     Values
       ('PAUL HERNANDEZ');
    Insert into TEXT_TEST
       (NAME)
     Values
       ('CHRISTOPHER Phil');
    COMMIT;
    
    --Now there is an alternative solution that is there,  instead of thee Oracle Text which is just a plain function given below (and it seems to work neat for my simple need of removing diacritical characters effect in search)
    --I need to evaluate which is better given my specific needs -the function below or Oracle Text.
    
    CREATE OR REPLACE FUNCTION remove_dia(p_value IN VARCHAR2, p_doUpper IN VARCHAR2 := 'Y')
    RETURN VARCHAR2 DETERMINISTIC
    IS
    OUTPUT_STR VARCHAR2(4000);
    begin
    IF (p_doUpper = 'Y') THEN
       OUTPUT_STR := UPPER(p_value);
    ELSE
       OUTPUT_STR := p_value;
    END IF;
    
    OUTPUT_STR := TRANSLATE(OUTPUT_STR,'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ', 'AAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
    
    RETURN (OUTPUT_STR);
    end;
    /
    
    
    
    --now I query for which name stats with  a P%:
    --Below query gets me unexpected result of one row as I am using Oracle Text where each word is parsed for search using CONTAINS...
    SQL> select * from text_test where contains(name,'P%')>0;
    
    NAME
    --------------------------------------------------------------------------------
    PAUL HERNANDEZ
    CHRISTOPHER Phil
    
    --Below query gets me the right and expected result of one row...
    SQL> select * from text_test where name like 'P%';
    
    NAME
    --------------------------------------------------------------------------------
    PAUL HERNANDEZ
    
    
    --Below query gets me the right and expected result of one row...
    SQL>  select * from text_test where remove_dia(name) like remove_dia('P%');
    
    NAME
    --------------------------------------------------------------------------------
    PAUL HERNANDEZ
    My need any only had to be able to do a search that ignores diacritical characters. To implement Oracle Text for this reason, I was wondering if it was the right choice! More when I find now that the functionality of the TYPE is not available in Oracle Text - Oracle text search are based on chips, or words, and they differ from the exit of the LIKE operator. So, maybe I just used a simple like function below and used that for my purpose instead of using Oracle Text:

    Just this feature (remove_dia) removes diacritical characters and maybe for my need is all what is needed. Can anyone help to revisit that given my need I better do not use Oracle text? I need to continue to use the feature of as operator and also need to bypass the diacritics so the simple function that I satisfied my need while Oracle Text causes a change in the behavior of search queries.

    Thank you
    OrauserN

    If what you need is AS feature and you do not have one of the features of Oracle complex search text, then I would not use Oracle Text. I would create an index based on a function on your name column that uses your function that removes diacritical marks, so that your searches will be faster. Please see the demo below.

    SCOTT@orcl_11gR2> CREATE TABLE TEXT_TEST
      2    (NAME  VARCHAR2(255 BYTE))
      3  /
    
    Table created.
    
    SCOTT@orcl_11gR2> Insert all
      2  into TEXT_TEST (NAME) Values ('muller')
      3  into TEXT_TEST (NAME) Values ('müller')
      4  into TEXT_TEST (NAME) Values ('MULLER')
      5  into TEXT_TEST (NAME) Values ('MÜLLER')
      6  into TEXT_TEST (NAME) Values ('PAUL HERNANDEZ')
      7  into TEXT_TEST (NAME) Values ('CHRISTOPHER Phil')
      8  select * from dual
      9  /
    
    6 rows created.
    
    SCOTT@orcl_11gR2> CREATE OR REPLACE FUNCTION remove_dia
      2    (p_value   IN VARCHAR2,
      3       p_doUpper IN VARCHAR2 := 'Y')
      4    RETURN VARCHAR2 DETERMINISTIC
      5  IS
      6    OUTPUT_STR VARCHAR2(4000);
      7  begin
      8    IF (p_doUpper = 'Y') THEN
      9        OUTPUT_STR := UPPER(p_value);
     10    ELSE
     11        OUTPUT_STR := p_value;
     12    END IF;
     13    RETURN
     14        TRANSLATE
     15          (OUTPUT_STR,
     16           'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ',
     17           'AAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
     18  end;
     19  /
    
    Function created.
    
    SCOTT@orcl_11gR2> show errors
    No errors.
    SCOTT@orcl_11gR2> CREATE INDEX text_test_remove_dia_name
      2  ON text_test (remove_dia (name))
      3  /
    
    Index created.
    
    SCOTT@orcl_11gR2> set autotrace on explain
    SCOTT@orcl_11gR2> select * from text_test
      2  where  remove_dia (name) like remove_dia ('mü%')
      3  /
    
    NAME
    ------------------------------------------------------------------------------------------------------------------------
    muller
    müller
    MULLER
    MÜLLER
    
    4 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3139591283
    
    ---------------------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |                           |     1 |  2131 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| TEXT_TEST                 |     1 |  2131 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | TEXT_TEST_REMOVE_DIA_NAME |     1 |       |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('mü%'))
           filter("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('mü%'))
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SCOTT@orcl_11gR2> select * from text_test
      2  where  remove_dia (name) like remove_dia ('P%')
      3  /
    
    NAME
    ------------------------------------------------------------------------------------------------------------------------
    PAUL HERNANDEZ
    
    1 row selected.
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3139591283
    
    ---------------------------------------------------------------------------------------------------------
    | Id  | Operation                   | Name                      | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT            |                           |     1 |  2131 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| TEXT_TEST                 |     1 |  2131 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX RANGE SCAN          | TEXT_TEST_REMOVE_DIA_NAME |     1 |       |     1   (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       2 - access("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('P%'))
           filter("SCOTT"."REMOVE_DIA"("NAME") LIKE "REMOVE_DIA"('P%'))
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SCOTT@orcl_11gR2>
    
  • Yahoo mail compose page announced the Indian Railways. Same is the case with some Gmail site. For this reason, it is difficult to compose mail. I need your help to clear advertising so that I can compose mail on the blank page, cordially. Maes

    Yahoo mail is normally empty. One can type mail in the blank part of . In my case the Compose page has rail logo. because I can't type my mail. Even if there is no problem in gmail-INBO isn't the case with Gmail site "A Google approach to email" or make up may site.
    For this reason, it is difficult to compose mail on yahoo mail. I need your help to clear advertising logo so that I can compose mail on a white page, cordially. eldiablo kumar

    You can also try to install Adblock Plus with Easylist subscription and check

  • I can't update Firefox, my computer is claiming that I need permission admin (everything else to date very well) I am the admin for this computer and I have the password. Any ideas?

    I can't update Firefox, I tried to disable Firewall etc. My computer says I need permission admin to update Firefox, even if I am the owner and the administrator of this computer. There are updates available and know the password for this computer. It all started when I installed the Noscript tool (that I tried to disable them with the same results)

    This has happened

    A few times a week

    == I installed Noscript tool

    See http://kb.mozillazine.org/Installing_Firefox#Mac_OS_X
    .....
    If you have Mac OS X 10.5 or newer then follow these steps:
    Download a new copy of the Firefox program: http://www.mozilla.com/firefox/all.html
    Trash the current demand for Firefox to do a clean reinstall.
    Install the new version you downloaded.
    Your profile data is stored in the Firefox profile folder, so you will not lose your bookmarks and other personal data.

  • "You are not allowed to change the settings for this printer. If you need to change the settings, contact your system administrator.

    XP Pro, SP3. I downloaded the free Bullzip pdf printer. Somehow my old printer pdf in my printer disappeared list which I have used for years. I get this message when installing - "you are not allowed to change the settings for this printer. If you need to change the settings, contact your system administrator. I click ok and it ends, but it doesn't work. It does not appear in the printer control panel as a printer to change anything.

    I built this computer at home and I'm the only one using it. What is this function 'administrator '? I've never had to administrator on any program. Never. That is what it is?

    CNET is infamous for the grouping of things in its downloads as much a / v programs report as junk (I went through the same thing using eSet NOD32 has / v).  I seem to remember that if you ignore the warning and download the exe file and then use a tool like the free 7-zip to extract only the file necessary to run the program you want, you can work around the problem.

    For a pdf printer free which is not CNET - and works well - go here--> http://www.cutepdf.com/products/cutepdf/writer.asp

    EDIT TO ADD A LINK:

    See, for example, http://forums.cnet.com/7723-12543_102-582307/safe-downloads-cnet-com-sorry-but-not-anymore/

  • Aspire laptop DVD player GONE! SlimType DVD A D58A4SH need a fix for this DVD player

    Is there a fix out there for a problem loading the driver for CD/DVD Acer Aspire of the laptop drive?  I have the Aspire 5334 with DVD Super Multi DL drive.

    I have a Slimtype DVD A D58A4SH player. He worked for a short time when I got the notebook and then it stopped completely.  There was an exclamation point on the list of devices and when I checked to see if the pilot that it has been updated, he said it was the last updated, etc.  BUT still does not.  I tried to roll back - which did not work.  So I uninstalled the drive completely.  Did a restart and it recognizes the DVD drive and started to install the driver for it.  Says the driver installation failed.  The dvd player is no longer listed in Device Manager.  I tried to go to the download page of support/driver from the Acer website for this brand and the computer model - it does not list DVD drivers at all.   So now I'm confused.  It was a Christmas gift from 2011. So I think that the warranty has expired.  So I'm pretty ticked if I need to replace a failed drive which is just came out barely a month outside the warranty of the year.  Someone out there who has a fix for this problem it will be greatly appreciated.  Thank you.

    I found a FIX for this problem!  Yay!

    I had an error Code 39 and did a search on the Microsoft Web site.  Here is the link.  I followed the "method 2" and it worked Finally, got my rear DVD player. Phew!

    I hope this helps others with the same problems:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-hardware/DVDCD-ROM-drive-code-39/a79de01...

  • I put in a new windows xp en my cable internet is not werking why is that what I need to down load drivers from dell for this

    I put in a new windows xp en my cable internet is not werking why is that what I need to down load drivers from dell for this

    Your Internet drivers are not part of XP. If you bought the device from Dell, you have other records besides that reinstall drive? I had 3 machines from Dell and they all came with the CD of drivers among others.

  • elockplugin that this need for now

    that this need for now

    Probably an Acer Empowering Technology.

    http://support.Acer-euro.com/empowering_technology/utility.html

  • My Windows 7 Enterprize evaluation copy has expired and I need to get a new license for this computer and two others

    My company Windows 7 evaluation copy has expired and I need to get a new license for this computer and two others?

    Evaluation copies are for your temporary assessment, so you can decide if you like the system.  If you want to continue using it, you buy it.

  • I need a device driver for this printer by Ricoh mp161l

    I need a device driver for this printer by Ricoh

    The hardware manufacturer is the only scource of drivers for their hardware

  • I bought one copy of Windows 7 Ultimate, 1 pc. Now, I need to get 6 several licenses for this copy, how can I do?

    I bought one copy of Windows 7 Ultimate, 1 pc.  Now, I need to get 6 several licenses for this copy, how can I do?

    You purchase 6 additional keys on the Microsoft Store, simply specify the quantity:

    http://www.Microsoft.com/Windows/buy/default.aspx

    http://Windows.Microsoft.com/en-us/Windows7/get-a-new-Windows-product-key

  • ODSEE 11.1.1.5 to OUD 11.1.2.3 migration - need a good document for this

    Hi, we intend to migrate from our ODSEE existing 11.1.1.5 to the latest version of OUD (11.1.2.3). I am looking for a step by step guide this immense task. Is there some official ID Doc for this? I want also to understand all possible things, that I must take into account before you perform this migration.

    Thanks in advance for the help.

    Thank you

    Surya Jesse, CISSP

    Hello

    I recommend you start with the guide of transition available to Oracle® Fusion Middleware Transition Guide for Oracle 11 g Release 2 (11.1.2) - unified directory summary

    If needed I can help for additional specific migration issues.

    Sylvain

    Please mark this answer as correct or helpful, when it is appropriate to make it easier for others to find

  • LightroomCC2015 just disabled use.stating I need to purchase a license. I'm running on the plan for this and other applications. How do I fix this, please?

    LightroomCC2015 disabled just use of the develop Module. Indicating that I need to buy a license. I'm running on the plan for this and other applications. How do I fix this, please?

    Please see the troubleshooting section below.

    Reference: creative judgment Cloud 2015 to return to the mode of trial

    Let us know if that helps.

    Kind regards

    Mohit

  • I need to create combinations of text and images for the web. How to do this in elements or do I need Photoshop for this feature?

    I need to create combinations of text and images for the web. How to do this in elements or do I need Photoshop for this feature?  Please advise!

    slynn5236 wrote:

    I need to create combinations of text and images for the web. How to do this in elements or do I need Photoshop for this feature?  Please advise!

    You can do in PSE.

    1. Do the math to see how much space you'll need on your canvas to the image and text.
    2. Navigate to the file queue > new.blank. Enter the width & height, background color, resolution 72 px / in. It is your canvas, and in the layers palette will be the background layer.
    3. Copy and paste the image. It turns on a separate layer
    4. Activate the tool move, position the image and resize if necessary
    5. Activate the text tool, and then type your text. It will be on a separate so layer
    6. Position the text.
    7. Flatten layers and go to file > save for web. I'm usually on the long side about 800 px. Don't forget to check "constrain proportions". Adjust the quality slider to suit. You will probably want the type of JPEG file for web work.
  • I have adobe certified m graphic deisgner... I can my own video tutorials to teach others about photoshop and download it into my own Web site? I m phhotographer also... should I I need legal permission for this gentleman...

    I have adobe certified m graphic deisgner... I can my own video tutorials to teach others about photoshop and download it into my own Web site?

    I m phhotographer also... should I I need legal permission for this gentleman...

    You probably want confirmation from an Adobe employee and I do not work for the company, but its completely legal to post images and videos done with and on Photoshop that you use a legal version of the software. Of course if you copy videos from someone else so they can possibly file a lawsuit against you for plagiarism or copyright violation, but I suspect that your not likely to do

    Terri

Maybe you are looking for

  • Change the color of bookmarks

    Hello.  My Safari bookmarks change from dark to light and light to the darkness when I hover over them.  Is there a way to disable this?  I can see where this might be a useful feature, but it's that I'm not interested.  Thank you.

  • Satellite L850 - need to change the STRANGE to the Blu - Ray player

    Hello My wife wants to use his laptop L850 for watching movies.But most of our home videos are Blu - Ray format. Can I change the DVD player for a reader Blu - Ray. If so should what model or specifications I look for?And will it take new drivers tha

  • I want to add my Canon MP190 printer.

    On IE, I have a printer icon on my toolbar. I can't get one on Firefox. How can I print?

  • Equium M40x-189 - confusion, memory...

    Hello According to the specifications of Toshiba, DDR max can be 2 GB, however, while looking for a certain number of sites at the best price, there is a bit in which state that the max is 1.5 GB. Can anyone confirm this is correct? Of course, the in

  • monitoring of device application has stopped working

    Hello - I'm having all kinds of problems with the Lexmark printers, but my current problem of the has to do with the above message.  I found a similar position from June 2009 who suggested running a scan, which I did and the info was provided: Window