Returning arrays from function

Hi all,
Can u please guide me in how to return an array from function .
Is it possible or not ??
If it is possible please tell me how to declare the function(prototype) that returns string array
and how to return the string array..
Thanks in Advance

Hi all,
Can u please guide me in how to return an array from
function .
Is it possible or not ??
If it is possible please tell me how to declare the
function(prototype) that returns string array
and how to return the string array..
Thanks in Advance
public String [] methodReturnsAnArray()
}

Similar Messages

  • Returned array from a method don't work properly over my Servlet

    Hi folks,
    I show you my code and then explain ;).
            double particle_sys[] = new double[100*5];
         double particle[];
      try {
             for(i = 0; i < 10; i++)
              particle_sys[i*5] = 1;
              particle_sys[i*5 + 1] = 0;
              particle_sys[i*5 + 2] = 1;
              particle_sys[i*5 + 3] = 0;
              particle_sys[i*5 + 4] = 0;     
         class call = new class();
         particle = call.MyFailingMethod(particle_sys);Now the code for the class which owns the method I call
    public class Jfjni
         static
                 System.loadLibrary("nativelibrary");
         public native void .........
         public double[] MyFailingMethod(double particle_sys[])
               double particle[] = new double[100*5];
               .... A call to a the native library to recibe the new data of particle_sys ....
             for(int i = 0; i < 10; i++)
              particle[i*5] = particle_sys[i*5];
              particle[i*5 + 1] = particle_sys[i*5 + 1];
              particle[i*5 + 2] = particle_sys[i*5 + 2];
              particle[i*5 + 3] = particle_sys[i*5 + 3];
              particle[i*5 + 4] = particle_sys[i*5 + 4];     
              return particle; 
    }A function in the native code changes the "particle_sys" array, but the returning value stills the same as the original passed to the function.
    Because of this, I have tested returning the array, dont works. I have tested also returning a copy of the array in "particle", dont works.
    Over standalone app and applet it runs correctly in all different ways, when I try it over a servlet the values of the array stand the same as before the method call.
    Please suggestions!
    Edited by: bifiado on Jan 15, 2008 10:27 AM
    Edited by: bifiado on Jan 15, 2008 10:28 AM

    I have partially solutioned this mistake but I have collateral ones. Looks like I forgot to put in web.xml the definition of the class I was calling from the principal servlet class. In other words, I have two classes, one is the extension of Httpservlet and the other (the class that make mistakes) is a class I call to do the JNI work.
    Now, I added in web.xml the definition of the JNI class (before I forgot) and looks the mistakes with arrays works, but know the there's a new problem and get an IOexception on the applet that call the servlet. When I coment the JNI calls the exception dissapears and all works ok, but I am not getting any exception report on the tomcat ".out".
    Please suggestions.

  • How to get the returned value from Functions with Callable statement?

    I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
    String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
    and getting the output variables by
    populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
    But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!

    Here is  my code
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_1202.
      MODULE subscreen_find.
      CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_1202.
      CALL SUBSCREEN SUBSEARCH.
    MODULE subscreen_find.
      case sy-ucomm.
        when 'SELECTED'.             "fcode
          case 'ZSKILL_SEARCH'.     "data element
            when '01'.                       " value range
              dynnr = 0110.
            when '02'.
              dynnr = 0111.
          endcase.
      endcase.
    ENDMODULE.
    kindly tell me what is wrong
    Edited by: Raji Thomas on Feb 8, 2010 10:20 AM

  • Please help how to get return array from rpg program on java code?

    Hi
    I have created a rpg program that returns 2 parameter 1 is the id and another one is list of array, when I called this program I passed two programparameter from my java code (see the code below) but when i checked what value would be return it is returned only first value of array. how will i get all array values ?
    please suggest me regarding this issues I amn't so much aware on java & AS400.
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(p2.toBytes(" "));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
    byte s[] = parmList[1].getOutputData(); // HERE I got only first value of returning array.
    parmList[1].getOutputDataLength();
    //String sts = ((String) (new AS400Text(10,o).toBytes(s[0])));
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();
    Reply With Quote

    Try this :
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    AS400Array arrP2 = new AS400Array(p2, 4);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(arrP2.toBytes({"","","",""}));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
         Object[] objArr =  (Object [])arrP2.toObject( parmList[1].getOutputData() );
         for(int i =0; i<objArr.length;i++){
                System.out.println( " SKU " + i +" : " + objArr.toString());
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();

  • Return array in function

    is it possibel to return an array through a function?
    CREATE OR REPLACE function test_bro return varray is...some thing like this!!!!
    Thanx

    ======================================================
    HOW YOU MAKE RECORD SET IN PL/SQL
    ======================================================
    CREATE OR REPLACE PACKAGE dummy AS
    TYPE emprecords IS REF CURSOR;
    PROCEDURE send_records
    (resultset OUT emprecords);
    END dummy;
    CREATE OR REPLACE PACKAGE BODY dummy AS
    PROCEDURE send_records (resultset OUT emprecords) IS
    BEGIN
    OPEN resultset
    FOR
    SELECT *
    FROM emp;
    END send_records;
    END dummy;
    CREATE OR REPLACE PROCEDURE receive_records IS
    emprecs dummy.emprecords;
    v_emp emp%ROWTYPE;
    BEGIN
    dummy.send_records (emprecs);
    LOOP
    EXIT WHEN emprecs%NOTFOUND;
    FETCH emprecs INTO v_emp;
    DBMS_OUTPUT.PUT_LINE (v_emp.empno
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.ename
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.job
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.mgr
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.hiredate
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.sal
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.comm
    &#0124; &#0124; ' '
    &#0124; &#0124; v_emp.deptno);
    END LOOP;
    END receive_records;
    SQL> START receive_records
    Procedure created.
    SQL> SET SERVEROUTPUT ON
    SQL> EXECUTE receive_records
    7369 SMITH CLERK 7902 17-DEC-80 800 20
    7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
    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 2450 10
    7788 SCOTT ANALYST 7566 19-APR-87 3000 20
    7839 KING PRESIDENT 17-NOV-81 5000 10
    7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
    7876 ADAMS CLERK 7788 23-MAY-87 1100 20
    7900 JAMES CLERK 7698 03-DEC-81 950 30
    7902 FORD ANALYST 7566 03-DEC-81 3000 20
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    7934 MILLER CLERK 7782 23-JAN-82 1300 10
    PL/SQL procedure successfully completed.
    null

  • Need help on returning arrays from C++ to Java

    Hi all, I hava a C++ application that contains a method that will return a float array to Java. I was able to write the Java Code, the JNI code to call the C++ method and compile them successfully. However on calling the native method from Java, the data in the array returned was not what I want. Please look through my code and see what is wrong with it.
    My Java Code:
    public native float[] Statistics(int inputKey); // This is the native method
    public float[] Stats(int k){ //Java method to call the native method so that I can use it in a Bean for a JSP.
    inputKey = k;
    float[] p = new float[4];
    p = Statistics(inputKey);
    return p;
    For this native method, an integer is passed from Java to the native side and the native method will use this integer to generate a float array size of 4 and populate it with data and return it back to Java.
    My JNI code
    extern "C"
    JNIEXPORT jfloatArray JNICALL
    Java_com_jspsmart_upload_FinalWaterMark_Statistics(JNIEnv *env, jobject obj, jint inputKey)
         jfloatArray floatArray = env->NewFloatArray(4); //This creates a new Java floatArray to store the C++ array
         CWatermarker2App p; // This is the C++ class to be used
         jfloat *stats = p.OnWatermarkStatistics(inputKey) // The C++ method returns a float pointer for an array of size 4
         env->SetFloatArrayRegion(floatArray, 0 , 4 , stats); //storing the C++ float array into the Java float Array
         return floatArray; // return the Array to Java
    In this example, I should have the data returned as [4952.0 2529.0 1706.0 33.6] in the array.
    But i am getting junk instead like 2.53E-23, 1.402E-15 etc..
    Is this a type conversion mistake?
    Please help!

    The first thing I notice - probably not the problem - is the line defining p. There is no reason to define this as an array of size 4, because the return from the native method is going to wipe that definition, replacing it with the return value of the native method. Alternatives:
    1. float[] p = null.
    2. float[] p = Statistics(inputKey);
    3. return Statistics(k);

  • Return value from function within package

    Hi,
    There is a function within a pl/sql package that I am trying to get data from. The problem is that the data returned can be up to 32,767 chars (varchar2 limit).
    It accepts 3 input parameters and returns on varchar2.
    The only way I can get it to work is using this syntax:
    ==================================
    variable hold varchar2(4000);
    call TrigCodeGenerator.GenerateCode(VALUE1', 'VALUE2','VALUE3') into :hold;
    print hold;
    =====================================
    However, if the data returned is greater than 4000 then I get this error:
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at line 1
    I can't increase the size of the variable (hold) as there seems to be a limitation on this type of variable.
    Also, I am running this in sql plus worksheet. Will it limit the display of the data (assuming, that someone can get the whole 32,767 chars displayed back) ?
    Thanks in advance,
    Ned

    Never mind,
    I declared the variable hold as clob and set the long and longchunksize parameters to 100,000 and it seems to work.

  • Error getting return value from function

    Hello
    I'm getting a error calling a function with ODP.NET from C#
    Code:
    OracleCommand oraCom = new OracleCommand("NORMALIZACION.nif",oraCon);
    oraCom.CommandType = CommandType.StoredProcedure;
    OracleParameter param1 = new OracleParameter("numnif",OracleDbType.Varchar2);
    param1.Value= "73667866A";
    param1.Direction = ParameterDirection.Input;
    OracleParameter param2 = new OracleParameter("nif",OracleDbType.Varchar2);
    param2.Size = 10; //FIXME line
    param2.Direction = ParameterDirection.ReturnValue;
    oraCom.Parameters.Add(param1);
    oraCom.Parameters.Add(param2);
    oraCom.ExecuteNonQuery();
    nif_norm = oraCom.Parameters["nif"].Value.ToString();
    if i write the FIXME line i get a error (ORA-06502) complaining about the size, no matter the value i wrote.
    If i don't write the FIXME line, it works but nif_norm is always empty, although the function i call is a single return 'Hello';
    Where am I wrong??
    Any help, examples with varchar2 as return value???
    BTW: the same code with the MS provider for Oracle works fine.

    Good point -- i shall do so.
    What I think I'm missing, in my quest for ODP.NET competence, is a solid set of example code. I've searched around and found various fragements here and there, but when it comes to data access from .NET there must surely be some finitie set of possibilities (if we can discount bad practices like building dynamic SQL statements without bind variables).
    For example, possibly in increasing order of complexity ...
    * Read a single value from a SQL statement ... "select emp_name from emp where rownum < 2"
    * Read a single value by passing in a parameter ... "select emp_name from emp where user_id = :?"
    * read multiple values ... "select emp_name from emp where user_id in (:?,:?)"
    * execute a stored procedure with no in or out parameters
    * retreive a value from a function with no parameters
    * pass a parameter to a stored procedure
    * read an out parameter from a stored procedure
    Then work with in and out ref cursors, blobs, whatever.
    Thoughts?

  • Return Vector from function and print it out.

    Hey guys, I am not sure I'm doing this right. I have a class that currently has one function "getVector". This takes a string that is input and turns into a Vector array and returns the array as Vector.
    Then in the second class I simply want to print out the Vector. I get no errors, but it doesn't print anything.
    If anyone can see what I am doing wrong I'd appreciate the help.
    Thanks!
    Here is the first class that has the getVector function
    import java.util.*;
    public class GetArrays {
        public Vector getVector (String s){
            Vector theVector = new Vector();
            StringTokenizer token=new StringTokenizer(s," ");
                while (token.hasMoreTokens()){
                    String tk=token.nextToken();// get each token
                    theVector.add(tk);
                 }// end while
            return theVector;
        }//end getVector
    }//end classAnd here is the class with main that tries to print it out.
    import java.util.*;
    public class ShowArrays {
        public static void main(String[] args) {
            ShowArrays showArrays = new ShowArrays();
            Vector theArray = new Vector();
            GetArrays getArrays = new GetArrays();
            theArray = getArrays.getVector("testing this function");
            ListIterator iterator = theArray.listIterator(theArray.size());
            while(iterator.hasNext()){
                System.out.println(iterator.next()+"\n");
              }// end while
        }//end main
    }//end class

    Remove the parameter to your call to. Adding this parameter starts the iterator at the element theArray.size(), which is the end of the array.
    ListIterator iterator = theArray.listIterator();

  • Returning Cursor from Function

    I have been struggling all afternoon to get a package function
    to return a cursor. Following some advice from the forums, I
    think I'm getting close. <vbg> But am getting a compile error
    on my RETURN statement. Can someone please help or post a
    working example of how to do this. Thanks!
    -- IN PACKAGE HEADER
    type package_cursor is ref cursor;
    function testfunction (p_system_date in date)
    return package_cursor;
    -- IN PACKAGE BODY
    function testfunction (p_system_date in date)
    return package_cursor is
    cursor c1 is
    select columns from tables where mydate = p_system_date;
    begin
    open c1;
    return c1;
    end testfunction;

    Nevermind, I figured it out by using Barbara Boehmer example in
    the "function returning record or table" thread.
    function testfunction (
    p_system_date in date)
    return package_cursor is
    vret package_cursor;
    begin
    open vret for
    select columns from tables where mydate = p_system_date;
    return vret;
    end testfunction;

  • Returning arrays from methods

    Hello,
    I'm trying to write a program that is structured like this;
    - The first method gets the user to enter 20 integers, which are stored in an array.
    - This method is then supposed to return this array.
    - The main method calls the first method (the one with the array).
    - The main method then calls another method which finds the highest value in the array passed to it (from the initial method) and then prints this value.
    I've tried for about 2 hours now though, and can't get it to return the array.
    Bear in mind I'm a novice at Java. I'll put my code below. Any help on this would be really appreciated because I'm totally stumped.
    public class part1
         static int counter=20;
         public static void enterMarks()
                   int classMarks[] = new int[20];
                   for (int i=0; i<20; i++)
                             classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                             System.out.println();
                             System.out.print("The marks entered were ");
                             for (int j=0; j<counter; j++)
                                       System.out.print(classMarks[j]+", ");
         public static void max()
    //               int[] classMarks2=classMarks;
         public static void main(String args[])
                   int[] marks=enterMarks();
    }Can someone tell me how I need to alter this so that the first method will return the array? Thanks in advance.

    Thanks for all the help so far everyone, I'm finally getting somewhere, but I've another problem. Here's my current code:
         static int counter=20;
         public static int[] enterMarks()
                   int classMarks[]= new int[counter];
                   for (int i=0; i<counter; i++)
                             classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                             System.out.println();
                             System.out.print("The marks entered were ");
                             for (int j=0; j<counter; j++)
                                       System.out.print(classMarks[j]+", ");
                                  return classMarks;     
         public static int max(int arr[])
                   int[] marks = classMarks;
                   int tempStore=0;
                   for (int k=0;k<counter;k++)
                        if(marks[k]>marks[k+1])
                        tempStore=marks[k];
                   return tempStore;
         public static void main(String args[])
                   int[] marks = enterMarks();
    }When I try to compile that, I'm told that the variable classMarks may not have been initialised. Surely it should be getting classMarks from the first method now that the first method is set up to return the array?

  • Returning objects from functions

    Hi,
    public HSSFRow someFunction() {
       HSSFRow returnrow;
       Iterator rowiterator = someobject.rowIterator();
          while(rowiterator.hasNext()) {
             returnrow = rowiterator.next();
       return returnrow;
    }My problem is this, I want to pass a HSSFRow object back from a function, but the constructor to this object is protected so i cant initialize an object, this code wont compile because it says that the returnrow object might not have been initialized. How do i get round this problem?

    Hey-
    You could just initialize returnrow to null and check for null whenever you call someFunction(), that should do it.
    Lee

  • Returning Recordsets from Functions

    Pardon my ignorance; there is probably a simple answer to this one, but I'm trying to make the leap to Oracle Stored Procedures and I have a basic question:
    I have created a Function in Oracle 8.1.7 EMP_SEL_ALL, based on the following SQL Statement:
    CREATE OR REPLACE FUNCTION "SCOTT"."EMP_SEL_ALL" (
              enuma          IN NUMBER)
              RETURN SCOTT.emp%ROWTYPE IS
    emp_row SCOTT.emp%ROWTYPE;
    BEGIN
         SELECT * into emp_row FROM SCOTT.emp
         WHERE empno = enuma;
    RETURN emp_row;
    END;
    The function compiles with no problems.
    I have written a Java call to execute the Function, which reads as follows. Because I am attempting to return an entire row, I assume that will equate to a ResultSet:
    sqlCallStmt = con.prepareCall("{ call SCOTT.EMP_SEL_ALL ? ) }");
    sqlCallStmt.setInt(1, 7369);
    result = sqlCallStmt.executeQuery();
    The error returned is as follows:
    java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00221: 'EMP_SEL_ALL' is not a procedure or is undefined
    Looking in DBA Studio, the Function is shown in the SCOTT schema, and I am logged in as that user. I am therefore inclined to think that, rather than a permissions issue, I have a syntax error somewhere, or I have left out a step.
    For anyone who has been down this road before, please advise. Is there a better way to do this via Stored Procedure? I have no problem querying the table and data in a standard SQL statement. Many thanks in advance.

    First, when you call a function I think you have to use the syntax {call ? = function_name} (notice where the ? goes.
    However, I still don't think you will be able to get this to work becuase a Java client cannot interpret a PL/SQL record (or rowtype, in your case).
    If you want to return the results as a recordset, you will have to move the function into package and declare a REF CURSOR for the return type. It appears your code only returns one row, however, so a recordset will create unnecessary overhead.
    It would probably be best to make your function a procedure that returns OUT parameters, one for each column selected.

  • Return variable from Function

    I have a function that if I write-host the variable $RDPUser from within the function it returns true, however I can't seem to get the variable to be seen outside the function, even if I make it global
    Function global:RDP (){
    $WorkstationName = Get-Content env:ComputerName
        # Run the qwinsta.exe and parse the output
        $queryResults = (qwinsta /server:$WorkstationName | foreach { (($_.trim() -replace "\s+",","))} | ConvertFrom-Csv)  
        # Pull the session information from each instance
        ForEach ($queryResult in $queryResults) {
            $RDPUser = $queryResult.USERNAME
            $sessionType = $queryResult.SESSIONNAME
            # We only want to display where a "person" is logged in. Otherwise unused sessions show up as USERNAME as a number
            If (($RDPUser -match "[a-z]") -and ($RDPUser -ne $NULL)) {  
                # When running interactively, uncomment the Write-Host line below to show the output to screen
                 $LoggedOnUser = $RDPUser
             $RDPHost
                #$SessionList = $SessionList + "`n`n" + $ServerName + " logged in by " + $RDPUser + " on " + $sessionType
    #Get Current Time
    $time2 = Get-Date
    #Get Logged-On User Details
    $user = Get-WmiObject Win32_Computersystem -ComputerName "."
    #Get Time User Logged On
    $time1 = Get-EventLog -LogName System -InstanceId 7001 -Newest 1
    #Set Variables for SQL
    $LogonDateTime = get-date -Format "MMM dd yyyy HH:mm:ss"
    $WorkstationName = Get-Content env:ComputerName
    $LoggedOnUser = $user.UserName
    $TimeToLogon = $time2.TimeOfDay.TotalSeconds - $time1.TimeGenerated.TimeOfDay.TotalSeconds
    $logonType = "Logon"
    #If workstation = QATest Set $result
    if ($workstationName -eq "QAtest") {$result = RDP ; $LoggedOnUser = $result}
    write-host $LogonDateTime
    write-host $WorkstationName
    write-host $LoggedOnUser
    write-host $TimeToLogon
    write-host $logonType
    Alter De Ruine

    For some reason I needed my If statement inside the function:
    Function RDP (){
    $WorkstationName = Get-Content env:ComputerName
        # Run the qwinsta.exe and parse the output
        $queryResults = (qwinsta /server:$WorkstationName | foreach { (($_.trim() -replace "\s+",","))} | ConvertFrom-Csv)  
        # Pull the session information from each instance
        ForEach ($queryResult in $queryResults) {
           $script:RDPUser = $queryResult.USERNAME
            $sessionType = $queryResult.SESSIONNAME
            # We only want to display where a "person" is logged in. Otherwise unused sessions show up as USERNAME as a number
            If (($RDPUser -match "[a-z]") -and ($RDPUser -ne $NULL)) {  
                # When running interactively, uncomment the Write-Host line below to show the output to screen
             $RDPUser
                #$SessionList = $SessionList + "`n`n" + $ServerName + " logged in by " + $RDPUser + " on " + $sessionType
    if ($workstationName -eq "QAV-RDHOST") {$script:LoggedOnUser = $RDPUser}
    #Get Current Time
    $time2 = Get-Date
    #Get Logged-On User Details
    $user = Get-WmiObject Win32_Computersystem -ComputerName "."
    #Get Time User Logged On
    $time1 = Get-EventLog -LogName System -InstanceId 7001 -Newest 1
    #Set Variables for SQL
    $LogonDateTime = get-date -Format "MMM dd yyyy HH:mm:ss"
    $WorkstationName = Get-Content env:ComputerName
    $LoggedOnUser = $user.UserName
    $TimeToLogon = $time2.TimeOfDay.TotalSeconds - $time1.TimeGenerated.TimeOfDay.TotalSeconds
    $logonType = "Logon"
    #Call function RDP
    RDP
    Alter De Ruine

  • How to Return Type from Function

    I've defined a type and a function in specification. But package body returns pls-00330 error (invalid use of type name or subtype name). What am I doing wrong? My intent is to write a function which will return a record containing two values. For now, I put "null;" as a placeholder.
    --specification
    CREATE OR REPLACE PACKAGE res.year_qtr AS
    TYPE yq_type IS RECORD
    (yr varchar2(2),
    qtr varchar2(1));
    FUNCTION yq_fun (date_in date)
    RETURN yq_type;
    END year_qtr;
    -body
    CREATE OR REPLACE PACKAGE BODY res.year_qtr AS
    FUNCTION yq_fun (date_in date)
    RETURN yq_type IS
    BEGIN
    null;
    RETURN year_qtr.yq_type; --get error on this line!
    END;
    END year_qtr;
    Edited by: user516543 on Mar 23, 2009 12:17 PM

    You need to declare a variable of that type and return the variable.
    You can't just return the type as it's not actually a declaration of that type.
    --specification
    CREATE OR REPLACE PACKAGE res.year_qtr AS
      TYPE yq_type IS RECORD
        (yr varchar2(2),
         qtr varchar2(1));
      FUNCTION yq_fun (date_in date)
        RETURN yq_type;
    END year_qtr;
    --body
    CREATE OR REPLACE PACKAGE BODY res.year_qtr AS
      FUNCTION yq_fun (date_in date) RETURN yq_type IS
        v_ret year_qtr.yq_type;
      BEGIN
        null;
        RETURN v_ret;
      END;
    END year_qtr;

Maybe you are looking for

  • Win 7 Zune to Airport Express

    Hi everyone can you please help me with something? I'm having trouble with something, I've used Airport Express Streaming Music via iPhone 4 and MacBook Pro, so far it's been great but I have a question. I have Win 7 on my Dell and I wanna ask if my

  • Blank page coming after logging into portal using Admin Account

    Hi, Recently i have changed the Portal Administrator password using Visual Admin. When i logged in, i get a blank page instead of getting tabs like user admin, system admin etc. Can any one tell me what is the problem? Thanks in Advance. Regs/Venkat

  • Ho to disable (Built in) Audio card in MacBook Pro?

    Ho to disable (Built in) Audio card in MacBook Pro?

  • CATS_DA and CADO different column fields

    Hy friends, i have problem with CATS_DA when i log on in different language in system. I create z field in CATSDB - zccode. When i create report in English version everything is fine - field zccode show results. When i logon in Bulgarian language in

  • Not able to connect pws prime cable provisioning

    Dear all.,    We are not able to connect the provisioning web service of prime cable provisoning . We installed prime cable provisioning all in default. We can't find the correct port aaddress for example we installed in centos machine IP is 10.2.0.1