Demonstrating the PL/SQL using SQL Developer functions

Good afternoon

I started writing some PL/SQL functions to replace some of the SQL I use most often.  Some very simple examples would be:

create or replace function func_test (p_1 number) return number

is

x number;
y number;

begin


x :=1;
y :=2;


return p_1 * x * y;


end func_test;

create or replace function func_test2 (p_1 varchar2) return varchar2


is


return_val varchar2(10);


begin


select p_1 into return_val from dual;


return return_val;


end func_test2;

However, on my place of work that I have not been granted created function privileges again until I can show some examples, which is understandable.

For the moment, without these privileges, is there a way I can build/test functions in principle locally using SQL Developer without the need to write functions in our database? I.e. can demonstrate meanings in SQL Developer, but devoid of envelope to create or syntax of replace?

I hope that's not too vague.

Using Oracle 11 g 2 (not connected to the database of the workplace at this time for a specific version not.)

3.4 SQL Developer

Thank you

TP

Hello

The obvious solution is to get privileges.  If your employer wants to do you something, they give you the necessary privileges to do so.  It's silly for them to tell you to do something, but refuses to let you do.

Otherwise, you can install Oracle on your own machine, as suggested above.  It's free and legitimate, if you only use it for learning and development.  Oracle Express Edition is very easy to install.

As a last resort, you can write functions and procedures that are local to an anonymous block, like this:

SET SERVEROUTPUT ON

DECLARE
Function func_test (p_1 number) return number
is
x number;
number of y;
Start
x: = 1;
y: = 2;
return p_1 * x y;
end func_test;
BEGIN
dbms_output.put_line (func_test (3))
|| '= func_test results.
);
END;
/

You can only call this kind of function of the anonymous block in which it is defined.

Tags: Database

Similar Questions

  • How to set up the PL/SQL Developer with customer instant

    Hi buddies!

    I want to install PL/SQL Developer. I would like to install Instant customer? I need to install the PL/SQL Developer in my pc that will access the database of the server.

    Please enlighten me.

    Thank you.

    See you soon!

    Nith

    Published by: user645399 on May 12, 2010 16:26

    user645399 wrote:

    Here are the steps I followed.

    I don't see a problem with these steps. It is correct. Step 7 is redundant (because of the where you have placed the tnsnames.ora file)-it is only really necessary when you place the file in another directory where +%ORACLE_HOME%\network\admin+ is no longer applicable.

    Note that the customer himself, needs to load the DLL of OIC InstantClient - and this DLL uses the settings of environment and the rest of "do its thing".

    If customer load another customer Oracle DLLS, then bets are open InstantClient is used, never mind will work.

    Only one copy of a DLL can exist in memory. So if some other s/w is using other DLL OIC, then this DLL is already loaded and will be used by all other client s/w. Nothing will be able to use the DLL itself InstantClient.

    Therefore, make sure that no Oracle client driver is loaded at all. Then make sure that when the client s/w requests to load the DLL of the OIC, it is loaded from the InstantClient directory.

    As far as I remember, the core Win32 LoadLibrary() call is made by the application - if the DLL is not in memory, the current (in the virtual machine for this process of Windows) directory is used. If the DLL does not exist there, the %PATH% variable is used to find and load the DLL. DLL usage meter is then set to 1. When multiple processes require the DLL, it is incremented. When a process ends, the usage count is decremented. When it reaches 0, its unloaded from memory.

    Result of all this is that only one module DLL (whatever the number and versions of the physical DLL files on disk) can reside in the kernel space, and you must ensure that the correct physical DLL is loaded by the kernel.

  • Connect the JSK & Sql developer

    Hello

    Someone trying to connect JSK SQL Developer? I tried to do by using the credentials of DB that I could see in server.xml but without success.

    Thank you!

    Usually the HSQLDB JSK uses works in memory mode, not in Server mode - see "Server Modes" at http://hsqldb.org/doc/guide/running-chapt.html. This means that it is not possible to use a tool like SQL Developer, TOAD, squirrel etc to connect in it. You can manually write a script so that it starts the DB in Server mode, you will need to change the jdbc connection string in server.xml in an appropriate manner. Then you should be able to use an external tool to reach the DB using the same jdbc connection string.

    If you just need to make a simple few queries then you can try the query tool that comes with HSQLDB. It is very basic, but has the advantage that you need not change the DB mode, it can connect to a DB in memory of a JSK running. To run it, find the hsqldb.jar in JSK and run:

    Java - cp hsqldb.jar org.hsqldb.util.DatabaseManagerSwing

    Phil

  • question on the pl/sql developer tool

    Hello

    I'm trying to debug a package by using pl/sql developer. It looks good, but the variable defined in the package do not display their value even in the mode debug to see what they have in this particular instance.

    How to get there?
    Thank you.
    KK

    Hello

    As HOEK has suggested... Please, go to the tool menu... preferences... under Oracle... debugger...

    You can see three text boxes... never... always... never. first check... button display the values of variables in a popup.

    Please enable this option... debug it...

    Concerning
    KPR

  • A question about the Oracle SQL Developer Oracle instance connection

    Hi all

    I would be grateful if you could kindly give me a helping hand.

    Recently, I installed the Oracle 11 g on Linux (ubuntu 8.10) database. I not create startup scripts. So here's how I start the server: (my linux user name is "dariyoosh", but in order to start the server I have connection on the terminal shell as user 'oracle')
    dariyoosh@alborz:~$ su oracle
    Password: 
    oracle@alborz:/home/dariyoosh$ cd
    oracle@alborz:~$ ORACLE_SID=database01
    oracle@alborz:~$ . oraenv
    ORACLE_SID = [database01] ? 
    The Oracle base for ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1 is /u01/app/oracle
    oracle@alborz:~$ sqlplus '/as sysdba'
    ...
    SQL> STARTUP NOMOUNT
    ORACLE instance started.
    ...
    SQL> ALTER DATABASE MOUNT;
    ...
    SQL> ALTER DATABASE OPEN;
    
    Database altered.
    Then I can work without any problems with my database and everything works pretty well. Today, I decided to install Oracle SQL Developer IDE as it makes it easier to modify the SQL code. My problem is that after reading the tutorial Oracle online, that I am still able to connect to my database. Firstly according to the method that I wrote, I have set up the Oracle instance. But then when I run Oracle SQL Developer I don't know what to choose for the user name and password? because since SQL * Plus shell as you can see I always write: "sqlplus 'virtue sysdba' and it does not prompt me for any password, I can access the database directly." Any idea? What password? What user name? for Oracle SQL Developer?

    Thanks in advance.

    When you connect "/ as sysdba", you actually connect as the user named SYS from the privileges of your operating system. SYS is the owner of the database and a privileged user. You really want to use this username for the day to day operations, but only for what can do only SYS. If you need a different user name. Several Oracle databases have a user named SCOTT who has a number of tables for use tutorial. By default, the password for SCOTT's "Tiger." You may also have other demo users, such as "HR". I admit that I forgot what is the password of the HR, but it doesn't really matter because SYS can change with this command:

    ALTER USER hr IDENTIFIED BY whateveryouwant;
    

    This command:

    SELECT USERNAME FROM ALL_USERS;
    

    lists all the users in your database. Understand that many of these users are there as owners of objects such as stored procedures and tables for Application Express, or TYPEs for Oracle Locator, not for general use. When you are ready to create your own objects, ask SYS create a username for them with

    CREATE USER myusername IDENTIFIED BY mypassword;
    

    and grant that user the privileges as necessary. You'll want to read before you get too far - I think that the developer of the Application Guide is a good starting point.

  • Failure of the assertion when using Labview ActiveX functions to communicate with the dll

    Hello

    I'm looking for suggestions and tips about the following error that I get when I use .NET Labview functions to communicate with the dll written in .NET environment. I just need a starting pointer on where can I search for the origin of this error. I am a newbie in. NET.

    I am also attaching the .vi I use, if this is of any help. All suggestions are welcome!  Thank you.

    The origin of the error found after studying the examples provided by the OR .NET. The callback function had to be moved out of the loop, which solved the problem.

  • Using the PL - SQL CAST function

    Hi friends,

    I write a stored procedure that attempts to convert a string returned by a function in a fixed-size varchar (3).


    ex:

    newChar varchar (3);


    newChar: = cast (fn_getValue (aInputValue) as varchar (3));

    This is the return type of the function ( fn_getValue) is varchar2 (4000), I should keep the return type as varchar2 because size should vary according to the entry.

    When I run the procedure gives:

    PLS-00103: encountered the symbol "(" quand attend une deles de valeurs suivantes:) "

    . ) @ %

    Please, help me to meet my needs.

    Thanks for your reply...

    It is a generic function and the 3 I've mentioned is just an example, it can change on different cases.

    I tried with select cast (fn_getValue as varchar (aInputValue) (3)) in the double newChar; his work...

    @John stegeman

  • Meaning of the column SQL Developer icon

    The icons next to some of my paintings have a white line horizontal wavvy through them (as the table is broken?). Anyone know what this means?


    Also, if I develop this tree table, some of the icons beside the columns resemble a "table cut in two." Can anyone interpret what do these symbols mean?

    Thank you

    >
    The icons next to some of my paintings have a white line horizontal wavvy through them (as the table is broken?). Anyone know what this means?
    >
    Which indicates a partitioned table.
    >
    Also, if I develop this tree table, some of the icons beside the columns resemble a "table cut in two." Can anyone interpret what do these symbols mean?
    >
    And those who would be the partitions.

    Don't know why they appear because you can't select or right-click on them (in 3.0.02 anyway) and you can get the list and more info by clicking on the table and tab partition on the top right window.

  • Extend the pl/sql table function

    declare
    type aar_test is table of the varchar2 (100)
    index of directory;
    aar_main aar_test;
    Start
    aar_main.extend;
    aar_main (aar_main. (Last): = 'expand the cell. "
    end;


    He's back a mistake... it's possible? If so how... plzzzzzzzz help me...

    Hello..

    Please go through this...!

    EXTEND
    *******
    This procedure has three forms. EXTEND appends one null element to a collection.
    EXTEND(n) appends n null elements to a collection.
    EXTEND(n,i) appends n copies of the ith element to a collection.
    
    EXTEND operates on the internal size of a collection.
    If EXTEND encounters deleted elements, it includes them in its tally.
    
    You cannot use EXTEND with associative arrays.
    

    Concerning
    KPR

    * If this answer is correct, then mark it as correct answer.
    * If this answer is useful, then mark it as a useful answer.

  • Solve the ODE which uses a max() function

    I have an ODE that I would like to solve in labview, but it's the max() for the third function OF. How can I integrate this into the Solver, RK4? I also apply it over a period of ten minutes (t here is in minutes), so I would put the RK4 Solver within some set time the end time to be 10 + loop with a start time register offset, or simply? I've included the variables + constants table for your reference.

    I do not understand your question about the error. Comments about all numerical values are already doubled.

    I found the basic problem. Column to 1 d array.vi returns an array containing a single element. This causes the Solver RK choke because it needs of 4 elements. The solution is to use only the Index table. This version converge in about 11 iterations.

    The solution seems to be sensitive to the value of h, so something's not quite yet. Fixing that may depend on your knowledge of what represent equations.

    I enclose the things that I've changed. In the f picker.vi I added the * as mentioned previously. I also reformatted some constants, although I think it was unnecessary. In the Main VI, I added a bunch of indicators so I could see what was going on. These indicators led me to the size of the array, I also added a waiting for me to see the results of each iteration. You will want to remove that in your final version.  I've implemented a "approximately equal" function to stop the loop. I put it as stop on an error.

    I consider calculate two options outside the loop and then simply select the one you want on the inside. No time to run, but if you need hundreds or thousands of iterations to solve the equations we can add.

    Lynn

  • I need to install the Oracle client until I can use Oracle SQL Developer?

    Hi all

    I used to use the PL/SQL Developer to connect to the Oracle server, and before it can work, I have to install Oracle on my PC client.

    So I wonder to know if I use Oracle SQL Developer, what I have to do the same thing? If not, why?

    Thank you very much.

    Hello Serge,

    you don't need a client. Developer SQL uses JDBC to connect.

    Concerning
    Marcus

  • Characters not visible (caused by hitting the bar space or TAB in PL/SQL developer tool) causing slow running query? and database with low performance?

    Hi all

    I need your help to get this issue resolved its urgent and I'm not able to get to the conclusion. Here is my scenario, I'm getting slow query runs because of some non-visible characters that are copied with the application of the PL/SQL developer tool. Please find below attached screenshot: Oracle_Issue

    Oracle_Isssue.png

    Note: This non-visible characters are caused when we write the query then us hit the SPACEBAR or press TAB PL/SQL developer tool

    I use the developer tool PL/SQL to write or test the query. Now I take this request copy paste in my application of the company (who takes this query connects to Oracle or any source of data base, catch data and produce PDF reports for customers).

    Now, my client is the Oracle user when I write and you run this query by the PL/SQL Developer, it works fine, but when I paste in my Inbox feature request (reporting system) and run it, it runs slower and jams to the customer database. Now after a little research I found that when I copy the query directly from PL/SQL developer at my request, he copy some characters not visible (introduced when we press SPACE or TAB in PL/SQL developer tool when writing query) with the request, then I copy this query again to my box of the application Notepad and delete these non-visible characters. Now, after removing the non-visible characters again once I copy backup question in my application and run the query, it works normally. Please find below attached screenshot: Oracle_Issue 2

    Oracle_Isssue_2.png

    So I think that the cause of slow performance is due to some INVISIBLE CHARACTERS present in the query.

    My application uses SQL server 2008-2012 at the backend to store data from different sources.

    Character set used: SQL_Latin1_General_CP1_CI_AS


    To write and test queries: PL/SQL developer tool

    My Client use Oracle 11 g

    Character set used: Normal character: NLS_CHARACTER: AL16UTF16

    National Characeter: NLS_NCHAR_CHARACTER: WE8WIN1521

    I just wanted to know the blocking process to the top of the database and the characters not visible how affecting slow running query of query database.

    Please let me know if I'm missing something or you need more information on this issue.

    Thanks in advance,

    HP

    Simple answer. No.

    Spaces and line breaks do not change the execution plan created. Does not plan to run slower or faster.

  • How to configure the settings of sql stored function

    Hello

    I use jdeveloper 11.1.2.3.0

    I have the below sql stored function
    function get_data(p_id     in number,
                      p_date   in date,
                      p_msg    out varchar) return number is
     .......
    
    end get_data;
    I would like to know how exactlly I should call this function of my AppModuleImpl.
    I tried several ways to set the parameters, but I'm getting java.sql.SQLException: Error invalid column index.

    Could you give me the correct code for this case?

    Thank you very much!

    check the docs [url http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcadvgen.htm#insertedID6] calling stored procedures and functions

  • error SQL server 17836 at the start of the sql developer

    I have a sqlserver 2005 error at startup of sql developer:

    Message
    Error: 17836, severity: 20, State: 1.

    Message
    The length specified in the network packet payload does not match the number of bytes read; the connection has been closed. Please contact the vendor of the client library. [CLIENT: 10.1.4.12]



    I use SQL Developer 2.1.1.64.45
    Platform Java (TM) 1.6.0_11

    I have the same problem on multiple computers

    Has anyone ever encountered this problem?
    Do you have an idea to solve this problem?

    Hi Philippe,.

    Thank you for this feedback.
    I replicate the problem and a fix has been applied.
    The fix will be available in the next SQL Developer 3.0 early access.

    Kind regards
    Dermot
    SQL development team.

  • SQL Developer Cart deployment wasting time on Date columns

    I tried to use the basket of SQL Developer functionality to migrate Oracle Cloud of AWS and I found that the time of all the date attributes element is not migrated. I checked the content of the deployment file and found that both the SQL * Loader control and the data file (ldr) ignore time information in an attribute table date.

    Anyone encountered this problem and knows how to get SQL Developer to pick up time when he pulls date attribute values?

    Hello

    There is no particular preference control the date format in the database. Public services | Basket, so the behavior has to be automatic or according to the definition of NLS.

    You might check if tools | Preferences | Database | NLS | Date format already contains an element of time format. If the cart unfurl dates does not work even with the right NLS format, then this it can be tapped. Perhaps an improvement has been made for the next version. Please let us know. I ping the developer about this.

    Kind regards
    Gary
    SQL development team

Maybe you are looking for

  • WiFi lost when I try to connect

    my laptop is HP 15-r012tx laptop I can not conect to wifi... When I press the kiss of connect for wifi, so here we go... and I can not install this softower {Qualcomm Atheros QCA9000 series Bluetooth 4.0 + HS Driver for Microsoft Windows 8.1} When I

  • Replace the motherboard

    Hello everyone, I need to replace the motherboard of my hp pavilion dv7 4013el because I think it's broken... (Serial: CNF0192CGT product: WS522EA #ABZ) Is there someone who can explain to me how I can understand that one should I choose? can you sug

  • Maximum amount of memory for HP Pavilion g7-2243us

    I think the memory of the Pavilion upgrade of my and I have a few questions: (1) what is the maximum amount of RAM that the g7-2243us Pavilion can have? (2) where can I get memory larger chips? Thank you! -SM11

  • I can't download the drivers on the site...

    The problem is with the site. How can I report the problem? I tried this on different machines in my office and with different browsers. Is not the case. Could not find a way to report the problem with the site itself. Help please?

  • Aspire E1 - 572G - 10 Windows shutdown and restart problems

    Hello! I bought this laptop a while ago, like almost 2 years, and probably more. It was powerful enough at the time, and I was very happy with it. So when Windows 10 came out I've updated, everything went well, but I made a mistake. I used a program