Sql function or sql procedure

I want to know if is better to use function or procedure for my problem.
First i need to read sql -> SELECT name, surname, date FROM ZKET_ZAPOSLENCI to get all data
When i get all data i need to use name and surname and change it with $name and $surname in some text.
Some text is:
Hello,
Worker $name $surname will be ...
Output must be:
Hello,
Worker Marco Kostrevc will be ..
and it must be inserted in database.
How can i make this?
regards
Edited by: senza on 15.9.2008 9:17

that you will not say that i am not doing anything
Code i try to make
create or replace procedure showcol (
statement in varchar2,
text_in in varchar2)
is
type cv_type is ref cursor;
cv cv_type;
val varchar2(32767);
procedure display_header_info ... end;
begin
/*construct the very dynamic query and open the cursor*/
open cv for || stavek;
loop
/*fetch the next row, and stop if no more rows*/
fetch cv into val;
exit when cv%notfound;
/*display the data, with a header before the first row*/
if cv$rowcount = 1
then
display_header_info(text_in, statement);
end if;
dbms_output.put_line (val);
end loop;
close cv; --al done clean up
end;
{code}
here i want to make replacement and return value (row by row) but do not how?
Edited by: senza on 16.9.2008 13:25
Edited by: senza on 16.9.2008 13:40                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Call a PL/SQL procedure or function from applet

    Could anyone please let me know how I could call a PL/SQL procedure
    or function from a JDBC method from applet with Internet Explorer?

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • Are the Pl/sql procedure and function atomic by themself

    i want to ask a question does oracle pl/sql procedure and function support Atomicity for the database by themself , or they became atomic incase we call them using begin -- end;

    You appear to be discussing transaction scope which is completely independent of PL/SQL blocks like procedures or how you call procedures. It's all in where commits (or rollbacks) are issued.
    If you have a procedure like this
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;where the first statement succeeds and the second statement fails as a result of a duplicate key, there will still be a Foo row in the table but the procedure will have thrown an exception. The caller of the procedure may choose to commit or rollback the change-- that will determine whether the first statement's results are made permanent. If you have a procedure like this,
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      commit;
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;the commit will make the first insert permanent regardless of whether the second statement fails no matter what the calling code does (that's one reason that putting commits in stored procedures is generally a bad idea-- the caller is in a much better position to know what other uncommitted work has been done and whether it is safe to commit.
    Justin

  • Send String[][] type to pl/sql procedure from function in App.module

    Hi,
    I use jdveloper 11.1.1.3.0
    I have a pl/sql procedure. the input type argument is 2-dimensional array(TAR) :
    types:
    create or replace TYPE ARRAYWEB as varray(160) of VARCHAR2(200);
    create or replace TYPE TAR as table of ARRAYWEB;
    Procedure:
    PROCEDURE testi(info IN TAR )
    I want to send type String[][] to this procedure from a function in Application module:
    1: String[][] str;
    2: CallableStatement plsqlBlock = null;
    3: String statement = "BEGIN testi(:1); END;";
    4: plsqlBlock = getDBTransaction().createCallableStatement(statement, 0);
    5: plsqlBlock.setArray(1, str); //get error
    6: plsqlBlock.executeUpdate();
    but in line 5 I don't know what type I should use, and this type(Array) doesn't work
    Habib

    Maybe this can help: http://www.devx.com/tips/Tip/22034
    Dario

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • How to call pl/sql procedure/function from XML

    Hi,
    I have a requirement to call pl/sql function/procedure from the RTF template. How can I do this?

    Hi,
    I have got the same requirement. We need to call the store PL/SQL procedure from the XML template to generate the fixedwidth files. Could you tell me if you are able to call PL/SQL procedure from XML template?
    Thanks,
    Ram

  • Function called by what PL SQL procedure

    Hello.
    I want to see all the callers of a PL SQL function. I know it is called by some PL SQL procedures in a package. How do I see who calls the function?
    Thanks.

    i think you can try this : select * from
    user_dependencies where type = 'FUNCTION' actually, that what should what things are referenced by your function
    and you'd be better off with ALL_DEPENDENCIES, since references can cross schemas.
    select name, type from all_dependencies
    where referenced_owner= 'ME'
    and referenced_name= 'MY_FUNCTION'
    and referenced_type ='FUNCTION'
    this will show what other things are using your function. if it's used by a package, it will not show the exact procedure or function within that package.

  • Problem calling PL/SQL procedure from Workflow function activity.

    Hi,
    I am trying to call a PL/SQL procedure from within my workflow activity.
    While I am able to execute the procedure through SQLDeveloper, the workflow function does not seem to call it.
    It seems that custom PL/SQL procedures have to conform to certain standards to be called within workflow applications. I have written my procedure to conform to those standards (referred to the example workflows).
    Could someone please help me with it?
    Thanks and regards.

    Hi,
    When I've received enough alpha reviews of the first few chapters of my book, I'll make chapter five available, which deals with writing functions for Workflows.
    Matt
    Alpha review chapters from my book "Developing With Oracle Workflow" are available on my website:
    http://www.workflowfaq.com
    http://forum.workflowfaq.com

  • Function Activity based on PL/SQL procedure

    Hi All
    I have a function activity in a workflow, which is based on a PL/SQL procedure. When I make any changes to the package or the stored procedure, workflow gives "Could not find package or program unit" error, even though the status of the package is valid in database.
    Essentially everytime I re-apply the package, I get this error. I then drop the package and then recreate it. Even then the error is not resolved immediately. Does this requires Apache bounce? Is there any other step that I am missing when we make changes to database packages that are based on workflow activities?
    It would be of great help if someone can throw light on the above.
    Many thanks in advance
    cheers
    Murari

    Hi,
    Have you tried searching this forum for the error message? There are plenty of posts about it here, on the WorkflowFAQ forum, and also in my blog about the issue, why it happens, and how you can avoid it.
    HTH,
    Matt
    WorkflowFAQ.com - the ONLY independent resource for Oracle Workflow development
    Alpha review chapters from my book "Developing With Oracle Workflow" are available via my website http://www.workflowfaq.com
    Have you read the blog at http://thoughts.workflowfaq.com ?
    WorkflowFAQ support forum: http://forum.workflowfaq.com

  • Passing arrays through multiple PL/SQL procedures and functions

    I am maintaining a large PL/SQL application. There is a main procedure that is initially called which subsequently passes information to other PL/SQL functions and procedures. In the end an error code and string is passed to PUT_LINE so it can be displayed. What I would like to be able to do is have an array that stores an error code and string for each error that it comes upon during going through each of the procedures and functions. This would involve passing these codes and strings from function to function within the pl/sql application. What would be the best way to implement this and is it possible to pass arrrays or records to other PL/SQL functions? Thanks.

    Here is one simulation ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>create or replace type n_array is table of number;
      2  /
    Type created.
    Elapsed: 00:00:07.10
    satyaki>
    satyaki>CREATE OR REPLACE PROCEDURE Get_Array(array_in IN n_array,
      2                                        array_out OUT n_array)  
      3  IS
      4  BEGIN 
      5    array_out := n_array(); 
      6    FOR i IN 1..array_in.count 
      7    LOOP 
      8      array_out.extend; 
      9      array_out(i) := array_in(i) * 2; 
    10    END LOOP;
    11  END Get_Array;
    12  /
    Procedure created.
    Elapsed: 00:00:00.89
    satyaki>
    satyaki>
    satyaki>Create or Replace Procedure Set_Array(myArray IN n_array)
      2  is  
      3    i   number(10);  
      4    rec emp%rowtype;  
      5    w n_array:=n_array(1200,3200);
      6    bucket n_array := n_array();
      7  Begin
      8    Get_Array(w,bucket);  
      9   
    10    for i in 1..myArray.count  
    11    loop 
    12      select *  
    13      into rec 
    14      from emp 
    15      where empno = myArray(i); 
    16      dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename);
    17      for j in 1..bucket.count
    18      loop
    19        dbms_output.put_line('Commission Sub Type: '||bucket(j));
    20      end loop;
    21    end loop; 
    22  End Set_Array;
    23  /
    Procedure created.
    Elapsed: 00:00:01.33
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    13 rows selected.
    Elapsed: 00:00:00.28
    satyaki>
    satyaki>declare
      2    v n_array:=n_array(9999,7777);  
      3  begin  
      4    Set_Array(v);  
      5  end;
      6  /
    Employee No:9999 Name:SATYAKI
    Commission Sub Type: 2400
    Commission Sub Type: 6400
    Employee No:7777 Name:SOURAV
    Commission Sub Type: 2400
    Commission Sub Type: 6400
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.15
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • How to test PL/SQL procedures and functions?

    What are the proven ways to test pl/sql procedures and functions? Specifically, procedures and functions that take cursor variables as IN OUT parameter, OR procedure and functions that takes an array as IN parameter?
    Thx.

    HI,
    One way could by using PL/SQL Develper tool, see Tools/Test Manager...
    Also there are others tools, see [Cleaning Up PL/SQL Practices|http://www.oracle.com/technology/oramag/oracle/04-mar/o24tech_plsql.html] and specifically oUnit
    Regards,
    PS: Your question is very general, could you provide an specific example you are trying?
    Edited by: Walter Fernández on Nov 11, 2008 4:04 PM - Adding PS

  • PL-SQL Procedures and Functions

    Hi All,
    while reading about PL-SQL Procedures I came across a concept, which states that we can not include bind or host variables in procedures because the compiler cannot resolve the reference to bind variable.
    Can someone please explain it more elaborately.
    Thank you.

    983037 wrote:
    while reading about PL-SQL Procedures I came across a concept, which states that we can not include bind or host variables in procedures because the compiler cannot resolve the reference to bind variable. Correct. This code cannot compile as it needs a bind variable to be bound:
    create or replace function GetEmpName return varchar2 is
      empName emp.ename%Type;
    begin
      select
        e.ename into empName
      from emp
      where emp_no = :BIND_VARIABLE;
      return( empName );
    end;Stored code cannot include bind variables as how is Oracle's compiler to know the data type of +:BIND_VARIABLE+ - or execute the function at run-time when the code is already compiled, but missing a bind call to supply a value for +:BIND_VARIABLE+ ?
    So the code needs to look as follows instead:
    create or replace function GetEmpName( empID number ) return varchar2 is
      empName emp.ename%Type;
    begin
      select
        e.ename into empName
      from emp
      where emp_no = empID;
      return( empName );
    end;The empID PL/SQL variable will be treated (transparently) as a bind variable when the SQL SELECT statement in that function is parsed and executed as a SQL cursor.
    You as caller, however need to supply bind variables when calling this function from an external client (e.g. SQL*Plus, Java, C/C++, etc). E.g.
    --// using sqlplus as example - create 2 sqlplus host variables
    var name varchar2(100)
    var id number
    --// assign a value to a host variable
    exec :id := 12345;
    --// execute the stored function code binding host variables as bind variables
    begin
      :name := GetEmpName( :id );
    end;
    --// display host variable
    print name

  • Oracle PL/SQL procedure/function to post message into weblogic jms queue

    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    Regards,
    Steve

    904640 wrote:
    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue

  • How to accept user values into a pl/sql procedure or function on every execution

    As we accept user values on every execution in a C or a java program, is it possible to do so with a pl/sql procedure or a funtion without using parameters?
    I cannot use parameters because it is required to be interactive while accepting the user-values like,
    Please enter your date of birth in 'dd/mm/yyyy' format:

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • How to use pl/sql procedure or function as part of validate the entity obj?

    Hi,
    we are migrating from oracle forms to jdeveloper 11g.
    I have a req. that,i wanted to use oracle pl/sql procedure to validate a attribute in an entity created with ADF BC?
    Is it possible to implement this?
    And how to show the error message from pl/sql procedure?
    Regards
    Murali.

    Hi,
    It is possible by using a method validator for the entity attribute.
    Create a transient attribute 'X'.
    In the validation section of the attribute to be validate, choose method validator.
    In the Error Message tab set error message as {0}.
    Below the value for tokentoken should source.X (X is the transient attribute name)
    In the java code of method validator, call the stored procedure and set the value of transient attribute X with the error message from SP.
    Use setX("ErrorMessage").
    Regards,
    Srinidhi

  • Basic Report Run from a PL/SQL Procedure

    I am hosed trying to start a BI Publisher report from a PL/SQL procedure. Basically, I have a procedure with a local variable defined as an XMLType. I need to call an RTF source, pass the xmlfile in and tell the RTF Engine where to send the output.
    The users guide implies that it involves calls to a Java program and I am totally ignorant of Java.
    I have successfully linked the RTF source into the XML_Publisher application and previewed it against a known data set. hat works.
    So, if I have a PL/SQL package with the local variable L_XML defined as XMLTYPE
    and an output file L_OUTBUT defined as VARCHAR2(100), what do I use to call the RTF Processor and generate the report to the output file?
    That is
    declare
    l_xml xmltype;
    l_output varchar2(100);
    begin
    -- stuff to build the xml variable
    -- insert the call to FTP Processor here Apparently, it should be
    -- something like
    package.procedure('linked_rtf file name', l_xml, l_output);
    end;
    If this calls a Java script, would also appreciate a sample copy of the script.
    My need is desperate so any assistance will be greatly appreciated.
    Many thanks
    Frank

    I don't think you can. The parameters passed to a VB dll are formatted differently than a C dll, especially strings. I know a C program has to use special data structures when working with a VB dll, and this is basically what Oracle is doing.
    It should be possible, however, to create a C dll that acts as a wrapper for the VB dll. I'm not sure this would save you anything, though. If you have to do that you may as well write the function in C.

Maybe you are looking for

  • Print to Dot-Matrix-Printer

    Hi, My actual job is to create an Report in Oracle Reports 10, running on an IBM AIX Unix Server and direct the output to an Dot-Matrix Printer. The Report is ready for Preview. What Parameter should be set as Report_DesFormat for that Dot-Matrix Pri

  • How to embed video in slideshow

    Is it possible to embed a video into a slidehsow, like so? http://www.workshare.com Thanks

  • How much space does a new app take?

    My 16GB Touch is pretty full (about 360MB left after all the music is loaded). How much space does the typical app take up?

  • Where to find files ci_types.xml and ci_tables.xml?

    We have installed Mobile Travel Expense and are wanting to add a custom help list for the field REASON. The documentation from 'Enhancement Guide' says we must create tables in both SAP R/3 and Mobile Travel Expenses Repository (files ci_types.xml, c

  • How do you take songs off in disk mode?

    How do I get songs off my iPod Mini with another program (I have iPod Access) when it is in disc mode? My iPod has been acting up the last month or so and I want to get the songs safely on my computer before I have to restore.