Package interpeting function call as variable call

When I try to compile my package the compiler mistakes the function calls in this collection for variables.:
type dayonelist IS TABLE OF NUMBER;
dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
I get this error message:
Error(244,35): PLS-00306: wrong number or types of arguments in call to 'WKDAYSMINUSONE'
Anyone know how I can correct this?

rthakur-
I'm a beginner at this and looking for help and not smart comments. I may not have your experience but I have a little more courtesy than you. Here's the package code:
CREATE OR REPLACE
package accessreports is
vc_FirstofMonth DATE;
vc_CurrentPick date;
PROCEDURE PICK_DATE
(p_first_of_month IN DATE);
PROCEDURE EXEC_REPORTS(p_first_of_month IN DATE);
PROCEDURE PRODUCTIVITY_INSERT
(p_first_of_month IN DATE);
PROCEDURE AVERAGE_BOARDINGS
(p_first_of_month IN DATE);
end accessreports;
CREATE OR REPLACE PACKAGE BODY accessreports IS
/*Below are all functions that provide variables for calulations and WHERE
clauses. All functions are at the top of the package for visibility to all procs and
convenience*/
FUNCTION curpick RETURN DATE IS p_current_pick DATE;
BEGIN
SELECT MAX(pick) AS
pick
INTO p_current_pick
FROM bus_picks;
RETURN p_current_pick;
END curpick;
FUNCTION wkdays(p_first_of_month IN DATE)
RETURN NUMBER IS p_wk NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
wk
INTO p_wk
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date,'MM-YYYY') = to_char(vc_firstofmonth,'MM-YYYY')
AND day_type = 'W')
RETURN p_wk;
END wkdays;
FUNCTION sadays (p_first_of_month IN DATE)
RETURN NUMBER IS p_sa NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
sa
INTO p_sa
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_sa;
END sadays;
FUNCTION sudays(p_first_of_month IN DATE)
RETURN NUMBER IS p_su NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(service_date) AS
su
INTO p_su
FROM
(SELECT DISTINCT service_date
FROM bus_daily_rides
WHERE to_char(service_date, 'MM-YYYY') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_su;
END sudays;
FUNCTION wkdaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_wkone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
wkone
INTO p_wkone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'W')
RETURN p_wkone;
END wkdaysminusone;
FUNCTION sadaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_saone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
saone
INTO p_saone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_saone;
END sadaysminusone;
FUNCTION sudaysminusone(p_first_of_month IN DATE)
RETURN NUMBER IS p_suone NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
suone
INTO p_suone
FROM
(SELECT DISTINCT to_char(add_months(service_date, -12), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_suone;
END sudaysminusone;
FUNCTION wkdaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_wktwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
wktwo
INTO p_wktwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_FirstofMonth, 'MM-YYYY')
AND day_type = 'W')
RETURN p_wktwo;
END wkdaysminustwo;
FUNCTION sadaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_satwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
satwo
INTO p_satwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'A')
RETURN p_satwo;
END sadaysminustwo;
FUNCTION sudaysminustwo(p_first_of_month IN DATE)
RETURN NUMBER IS p_sutwo NUMBER;
BEGIN
vc_FirstofMonth := p_first_of_month;
SELECT COUNT(*) AS
sutwo
INTO p_sutwo
FROM
(SELECT DISTINCT to_char(add_months(service_date, -24), 'dd-mm-yyyy')
FROM bus_daily_rides
WHERE to_char(service_date, 'mm-yyyy') = to_char(vc_firstofmonth, 'MM-YYYY')
AND day_type = 'U')
RETURN p_sutwo;
END sudaysminustwo;
/*PICK_DATE determines if the report being provided takes place during a pick month.*/
PROCEDURE pick_date(p_first_of_month IN DATE)
AS
BEGIN
vc_firstofmonth := p_first_of_month;
vc_currentpick := curpick();
IF to_char(vc_firstofmonth, 'MM-YYYY') <> to_char(vc_currentpick, 'MM-YYYY') THEN
accessreports.exec_reports(p_first_of_month);
ELSE
NULL;
/*This procedure being built*/
END IF;
END pick_date;
/*EXEC_REPORTS executes the procs below it with two input vars.*/
PROCEDURE exec_reports(p_first_of_month IN DATE)
IS
BEGIN
accessreports.productivity_insert(p_first_of_month);
accessreports.average_boardings(p_first_of_month);
END;
/*Last two procs use dynamic SQL to rotate through the different day types and
pls_integer of days for each day type.*/
PROCEDURE productivity_insert(p_first_of_month DATE)
AS
TYPE daylist IS TABLE OF VARCHAR2(1);
DAYS daylist := daylist('W', 'A', 'U');
TYPE countlist IS TABLE OF NUMBER;
counts countlist := countlist(wkdays(), sadays(), sudays());
BEGIN
FOR i IN 1 .. 3 LOOP
EXECUTE IMMEDIATE 'INSERT INTO RFC_BUS' || DAYS(i) || 'PRODUCTIVITY(ROUTE,PPPH)
SELECT a.route, ((sr05 / sy05)/' || counts(i) || ') AS "RATIO"
FROM (SELECT route,
SUM (DECODE (TO_CHAR (pick, "MM-YYYY"),
to_char(vc_FirstofMonth, "MM-YYYY"), platform_hours, null)) AS sy05
FROM bus_platformhours
WHERE day_type =' || DAYS(i) || ' and platform_hours > 0
GROUP BY route) a,
(SELECT route,
SUM (DECODE (TO_CHAR (service_date, "mm-yyyy"),
to_char(vc_FirstofMonth, "MM-YYYY"), rides, null)) AS sr05
FROM bush_daily_rides
WHERE day_type = ' || DAYS(i) || 'GROUP BY route) b
WHERE a.route = b.route
ORDER BY a.route
VALUES(
p_route,
p_ratio
) USING days(i), counts(i)';
END LOOP;
END productivity_insert;
PROCEDURE average_boardings(p_first_of_month DATE)
AS
type daylist IS TABLE OF VARCHAR2(1);
DAYS daylist := daylist('W', 'A', 'U');
type countlist IS TABLE OF NUMBER;
counts countlist := countlist(wkdays(), sadays(), sudays());
type dayonelist IS TABLE OF NUMBER;
dayone dayonelist := dayonelist(wkdaysminusone(), sadaysminusone(), sudaysminusone());
type daytwolist IS TABLE OF NUMBER;
daytwo daytwolist := daytwolist(wkdaysminustwo(), sadaysminustwo(), sudaysminustwo());
BEGIN
vc_firstofmonth := p_first_of_month;
FOR i IN 1 .. 3 LOOP
EXECUTE IMMEDIATE 'INSERT INTO RFC' || DAYS(i) || 'BUSAVG_RIDES_AND_PROD(ROUTE, THIRD_YEAR, SECOND_YEAR, PRESENT_YEAR,
PER_DIFF_THIRDTOPRESENT, PER_DIFF_SECONDTOPRESENT, ROUTETWO, PASS_PLAT_HOUR)
select r.*,
t2.*
from (
select *
from (select route,
sum(y04)/' || counts(i) || ' y04,
sum(y05)/' || dayone(i) || ' y05,
sum(y06)/' || daytwo(i) || ' y06,
decode(sum(y04),0,0,(sum(y06)-sum(y04))/sum(y04)*100) Percent_difference_04to06,
decode(sum(y05),0,0,(sum(y06)-sum(y05))/sum(y05)*100) Percent_difference_05to06
from (select route,
     decode(to_char(service_date,"yy"),"04",Rides,0) y04,
decode(to_char(service_date,"yy"),"05",Rides,0) y05,
     decode(to_char(service_date,"yy"),"06",Rides,0) y06
from bus_daily_rides
where TO_CHAR(service_date, "YY") IN ("04","05", "06")
AND TO_CHAR(SERVICE_DATE,"MM")=TO_CHAR(vc_FirstofMonth, "MM")
AND day_type=' || DAYS(i) || '
group by route
WHERE ROWNUM > 0
) r,
' || DAYS(i) || '"_"Route_productivity t2
where t2.route = r.route
VALUES(p_route,
p_third_year,
p_second_year,
p_present_year,
p_thirdtopresent,
p_secondtopresent,
p_routetwo,
p_ppph) USING counts(i), days(i), daysone(i), daystwo(i)';
END LOOP;
END;
END accessreports;

Similar Messages

  • Package/procedure/function calls done with in a package

    Hi Experts,
    Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
    It would be great if we can provide a tree like structure of the objects being called/used.
    btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
    Appreciate your time..
    Thanks
    Manju

    manjukn wrote:
    Hi Experts,
    Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
    It would be great if we can provide a tree like structure of the objects being called/used.
    btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
    Appreciate your time..What database version do you have?
    11g I think provides some sort of fine grained dependency information which can detail packages, but prior to 11g you can only get dependencies on the database objects themselves of which functions/procedures within a package are not, as the package itself is the object.
    I don't think there's any easy way to find out from any tables or views and I think third party tools would have to parse the code to determine such things themselves, so that may be one of your only options.

  • Actionscript variable name function call

    I'm attempting to call a function dynamically using a string variable.  I know that to normally do this, I would use code like the following:
         var functionName:String = "ii_" + currentItem.id;
         var myData:Array = this[functionName](parameter1, parameter2, parameter3);
    However, my function is actually in another flex directory/package called UploadApps.customUploadFunctions.  I've tried this sort of thing:
         var functionName:String = "ii_" + currentItem.id;
         var myData:Array = UploadApps.customUploadFunctions.this[functionName](parameter1, parameter2, parameter3);
    but this doesn't work.  Any ideas on how I go about calling a function with a variable name in another package?
    John

    Thanks Alex.  The function in the package is defined as:
             package UploadApps.customUploadApps
                  public function ii_000010(inputItem:InputItem, periodDates:Object, inputItemBox:VBox, branchId:int, uploadStatusData:ArrayCollection, validatorArray:Array):Array {
    with the file name being ii_000010.as, but when I call it as such:
             import UploadApps.customUploadApps.*;
              var functionName:String = "ii_" + currentItem.id;
              someArray = UploadApps.customUploadApps[functionName](currentItem, thisFieldDates, inputItemBox, BranchId, uploadStatusData, validatorArray);
    I get the errors:
             1120: Access of undefined property UploadApps.customUploadApps.
              1182: Package cannot be used as a value: UploadApps.customUploadApps.
    John

  • Execute Oracle Package Function call from FORTE

    Has anyone EVER successfully execute an Oracle Package Function call from FORTE
    via " sql execute procedure "?
    Here's my question, I am able to execute a stored procedure but hasn't figured
    out a way to execute a function which defined in a package. The syntax goes
    like this: sql execute procedure <PackageName>.<FunctionName> ( input
    input_parm, output output_parm). If anyone EVER successfully execute a
    function, please let me know, thanks.

    You'll need to provide a column alias for the function call:
    select func(val) as alias from dual

  • Function call in procedure within Package Body

    I am a novice in PL/SQL so that I can't find out where the problem is. I am testing a function call in procedure within a Package Body.
    But the PL/SQL Complier doesn't compile the package body but I don't know what I do wrong. Plz let me know how to call a function in procedure within a Package Body?
    Here are the Packaget test programs..
    CREATE OR REPLACE PACKAGE manage_students
    IS
    PROCEDURE find_sname;
    PROCEDURE find_test;
    PROCEDURE find_test_called;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE;
    END manage_students;
    CREATE OR REPLACE PACKAGE BODY manage_students AS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    PROCEDURE find_sname
    IS
    BEGIN
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER is : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_sname;
    PROCEDURE find_test
    IS
    BEGIN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER Called from another procedure : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE
    IS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    RETURN v_max_nbr;
    EXCEPTION
    WHEN OTHERS
    THEN
    DECLARE
    v_sqlerrm VARCHAR2(250) :=
    SUBSTR(SQLERRM,1,250);
    BEGIN
    RAISE_APPLICATION_ERROR(-20003,
    'Error in instructor_id: '||v_sqlerrm);
    END;
    END GET_LASTMT;
    PROCEDURE find_test_called
    IS
    BEGIN
    BEGIN
    V_max := Manage_students.GET_LASTMT;
    DBMS_OUTPUT.PUT_LINE('MAX_NUMBER :'|| V_max);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN NULL;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test_called;
    END manage_students;
    DECLARE
    v_max SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    manage_students.find_sname;
    DBMS_OUTPUT.PUT_LINE ('Student ID: Execute.');
    manage_students.find_test;
    manage_students.find_test_called;
    END;
    -----------------------------------------------------------------------------------------------

    Hi,
    Welcome to the forum!
    You'll find that there are a lot of people willing to help you.
    Are you willing to help them? Whenever you have a problem, post enough for people to re-create the problem themselves. That includes CREATE TABLE and INSERT statements for all the tables you use.
    Error messages are very helpful. Post the complete error message you're getting, including line number. (It looks like your EXCEPTION sections aren't doing much, except hiding the real errors. That's a bad programming practice, but probably not causing your present problem - just a future one.)
    Never post unformatted code. Indent the code to show the extent of each procedure, and the blocks within each one.
    When posting formatted text on this site, type these 6 characters:
    \(all small letters, inside curly brackets) before and after each section of formatted test, to preserve the spacing.
    For example, the procedure find_test_called would be a lot easier to read like this:PROCEDURE find_test_called
    IS
    BEGIN
         BEGIN
              V_max := Manage_students.GET_LASTMT;
              DBMS_OUTPUT.PUT_LINE ('MAX_NUMBER :' || V_max);
         EXCEPTION
              WHEN OTHERS
              THEN
                   DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
                   RETURN      NULL;
         END;
         COMMIT;
    EXCEPTION
         WHEN OTHERS
         THEN
              DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
    END find_test_called;
    It's much easier to tell from the code above that you're trying to return NULL from a procedure.  Only functions can return anything (counting NULL); procedures can have RETURN statements, but that single word"RETURN;" is the entire statement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • SSDT vs 2013 and Clr function, call a Clr method name dynamically using SQLCMD variables

    Hello,
    My question is this, hopefully this makes sense:
    How could I got about doing this, inside a SQL function, I would like to re-name the Clr method call based on a SQLCMD variable? 
    I have a Clr project to encrypt/decrypt data, there are different method names depending on the deployment types.
    For the definition of a function called dbo.EncryptThis, I would like to use a SQLCMD variable to change the name depending on SQLCMD variables. This works fine in SQL Server Mgmt studio, but VS 2013 fails to recognize the SQLCMD variable and the build fails
    with: "Error
    1
    SQL71521: A method with a matching signature was not found in the loaded assembly.".
    THis code works fine in SQL Server Mgmt Studio, but fails to build in the SSDT project.
    In the SSDT project I have the SQLCMD variable defined and think I have SQLCMD mode enabled, by doing this:
    Right click file > Execution Settings > SQLCMD mode
    CREATE FUNCTION [dbo].[EncryptData]
    (@str NVARCHAR (MAX))
    RETURNS NVARCHAR (MAX)
    AS
    EXTERNAL NAME [CryptoClrAssembly].[LibName].[EncryptData$(MethodName)]
    Is this even possible in SSDT? or would I have to do this in a post-deploy script?

    Hi Kevin,
    Thanks for the info.
    Bummer, so the only other solution I have is to create a post-deploy script to change the function based on a SQLCMD variable or other logic?
    What would be really cool, would be if during the build process the SQLCMD variables would get replaced with the default value to the SQLCMD variable, thus would allow to build the project. Also, during deployment, if someone entered an incorrect method
    from the assembly it would just fail.

  • Java.lang.VerifyError - Incompatible object argument for function call

    Hi all,
    I'm developing a JSP application (powered by Tomcat 4.0.1 in JDK 1.3, in Eclipse 3.3). Among other stuff I have 3 classes interacting with an Oracle database, covering 3 use cases - renaming, adding and deleting an database object. The renaming class simply updates the database with a String variable it receives from the request object, whereas the other two classes perform some calculations with the request data and update the database accordingly.
    When the adding or deleting classes are executed, by performing the appropriate actions through the web application, Tomcat throws the following:
    java.lang.VerifyError: (class: action/GliederungNewAction, method: insertNewNode signature: (Loracle/jdbc/driver/OracleConnection;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V) Incompatible object argument for function call
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:120)
         at action.ActionMapping.perform(ActionMapping.java:53)
         at ControllerServlet.doResponse(ControllerServlet.java:92)
         at ControllerServlet.doPost(ControllerServlet.java:50)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    ...The renaming works fine though. I have checked mailing lists and forums as well as contacted the company's java support but everything I have tried out so far, from exchanging the xerces.jar files found in JDOM and Tomcat to rebuidling the project didn't help.
    I just can't explain to myself why this error occurs and I don't see how some additional Java code in the other 2 classes could cause it?
    I realize that the Tomcat and JDK versions I'm using are totally out of date, but that's company's current standard and I can't really change that.
    Here's the source code. I moved parts of the business logic from Java to Oracle recently but I left the SQL statements that the Oracle stored procedures are executing if it helps someone.
    package action;
    import java.sql.CallableStatement;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.StringTokenizer;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import oracle.jdbc.driver.OracleConnection;
    * This class enables the creation and insertion of a new catalogue node. A new node
    * is always inserted as the last child of the selected parent node.
    public class GliederungNewAction implements Action {
         public String perform(ActionMapping mapping, HttpServletRequest request,
                   HttpServletResponse response) {
              // fetch the necessary parameters from the JSP site
              // the parent attribute is the selected attribute!
              String parent_attribute = request.getParameter("attr");
              String catalogue = request.getParameter("catalogue");
              int parent_sequenceNr = Integer.parseInt(request.getParameter("sort_sequence"));
              // connect to database    
              HttpSession session = request.getSession();   
              db.SessionConnection sessConn = (db.SessionConnection) session.getAttribute("connection");
              if (sessConn != null) {
                   try {
                        sessConn.setAutoCommit(false);
                        OracleConnection connection = (OracleConnection)sessConn.getConnection();
                        int lastPosition = getLastNodePosition( getLastChildAttribute(connection, catalogue, parent_attribute) );
                        String newNodeAttribute = createNewNodeAttribute(parent_attribute, lastPosition);
                        // calculate the sequence number
                        int precedingSequenceNumber = getPrecedingSequenceNumber(connection, catalogue, parent_attribute);
                        if ( precedingSequenceNumber == -1 ) {
                             precedingSequenceNumber = parent_sequenceNr;
                        int sortSequence = precedingSequenceNumber + 1;
                        setSequenceNumbers(connection, catalogue, sortSequence);
                        // insert the new node into DB
                        insertNewNode(connection, catalogue, newNodeAttribute, parent_attribute, "Neuer Punkt", sortSequence);
                        connection.commit();
                   } catch(SQLException ex) {
                        ex.printStackTrace();
              return mapping.getForward();
          * Creates, fills and executes a prepared statement to insert a new entry into the specified table, representing
          * a new node in the catalogue.
         private void insertNewNode(OracleConnection connection, String catalogue, String attribute, String parent_attribute, String description, int sortSequence) {
              try {
                   String callAddNode = "{ call fasi_lob.pack_gliederung.addNode(:1, :2, :3, :4, :5) }";
                   CallableStatement cst;
                   cst = connection.prepareCall(callAddNode);
                   cst.setString(1, catalogue);
                   cst.setString(2, attribute);
                   cst.setString(3, parent_attribute);
                   cst.setString(4, description);
                   cst.setInt(5, sortSequence);
                   cst.execute();
                   cst.close();
              } catch (SQLException e1) {
                   // TODO Auto-generated catch block
                   e1.printStackTrace();
    //          String insertNewNode = "INSERT INTO vstd_media_cat_attributes " +
    //                    "(catalogue, attribute, parent_attr, description, sort_sequence) VALUES(:1, :2, :3, :4, :5)";
    //          PreparedStatement insertStmt;
    //          try {
    //               insertStmt = connection.prepareStatement(insertNewNode);
    //               insertStmt.setString(1, catalogue);
    //               insertStmt.setString(2, attribute);
    //               insertStmt.setString(3, parent_attribute);
    //               insertStmt.setString(4, description);
    //               insertStmt.setInt(5, sortSequence);
    //               insertStmt.execute();
    //               insertStmt.close();
    //          } catch (SQLException e) {
    //               e.printStackTrace();
          * This method returns the attribute value of the last child of the parent under which
          * we want to insert a new node. The result set is sorted in descending order and only the
          * first result (that is, the last child under this parent) is fetched.
          * If the parent node has no children, "parent_attr.0" is returned. 
          * @param connection
          * @param catalogue
          * @param parent_attribute
          * @return attribute of the last child under this parent, or "parent_attr.0" if parent has no children
         private String getLastChildAttribute(OracleConnection connection, String catalogue, String parent_attribute) {
              String queryLastChild = "SELECT attribute FROM vstd_media_cat_attributes " +
                                            "WHERE catalogue=:1 AND parent_attr=:2 ORDER BY sort_sequence DESC";
              String lastChildAttribute;
              PreparedStatement ps;
              try {
                   ps = connection.prepareStatement(queryLastChild);
                   ps.setString(1, catalogue);
                   ps.setString(2, parent_attribute);
                   ResultSet rs = ps.executeQuery();
                   /* If a result is returned, the selected parent already has children.
                    * If not set the lastChildAttribute to parent_attr.0
                   if (rs.next()) {
                        lastChildAttribute = rs.getString("attribute");
                   } else {
                        lastChildAttribute = parent_attribute.concat(".0");
                   rs.close();
                   return lastChildAttribute;
              } catch (SQLException e) {
                   e.printStackTrace();
                   return null;
          * This helper method determines the position of the last node in the attribute.
          * i.e for 3.5.2 it returns 2, for 2.1 it returns 1 etc.
          * @param attribute
          * @return position of last node in this attribute
         private int getLastNodePosition(String attribute) {
              StringTokenizer tokenizer = new StringTokenizer(attribute, ".");
              String lastNodePosition = "0";
              while( tokenizer.hasMoreTokens() ) {
                   lastNodePosition = tokenizer.nextToken();
              return Integer.parseInt(lastNodePosition);
          * This method calculates the attribute of a node being inserted
          * by incrementing the last child position by 1 and attaching the
          * incremented position to the parent.
          * @param parent_attr
          * @param lastPosition
          * @return attribute of the new node
         private String createNewNodeAttribute(String parent_attr, int lastPosition) {
              String newPosition = new Integer(lastPosition + 1).toString();
              return parent_attr.concat("." + newPosition);
          * This method checks if the required sequence number for a new node is already in use and
          * handles the sequence numbers accordingly.
          * If the sequence number for a new node is NOT IN USE, the method doesn't do anything.
          * If the sequence number for a new node is IN USE, the method searches for the next free
          * sequence number by incrementing the number by one and repeating the query until no result
          * is found. Then all the sequence numbers between the required number (including, >= relation)
          * and the nearest found free number (not including, < relation) are incremented by 1, as to
          * make space for the new node.
          * @param connection
          * @param catalogue
          * @param newNodeSequenceNumber required sequence number for the new node
         private void setSequenceNumbers(OracleConnection connection, String catalogue, int newNodeSequenceNumber) {
              // 1. check if the new sequence number exists - if no do nothing
              // if yes - increment by one and see if exists
              //           repeat until free sequence number exists
              // when found increment all sequence numbers freeSeqNr > seqNr >= newSeqNr
              String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
                        "WHERE catalogue=:1 AND sort_sequence=:2";
              PreparedStatement ps;
              try {
                   ps = connection.prepareStatement(query);
                   ps.setString(1, catalogue);
                   ps.setInt(2, newNodeSequenceNumber);               
                   ResultSet rs = ps.executeQuery();
                   // if no result, the required sequence number is free - nothing to do
                   if( rs.next() ) {
                        int freeSequenceNumber = newNodeSequenceNumber;
                        do {
                             ps.setString(1, catalogue);
                             ps.setInt(2, freeSequenceNumber++);
                             rs = ps.executeQuery();
                        } while( rs.next() );
                        // increment sequence numbers - call stored procedure
                        String callUpdateSeqeunceNrs = "{ call fasi_lob.pack_gliederung.updateSeqNumbers(:1, :2, :3) }";
                        CallableStatement cst = connection.prepareCall(callUpdateSeqeunceNrs);
                        cst.setString(1, catalogue);
                        cst.setInt(2, newNodeSequenceNumber);
                        cst.setInt(3, freeSequenceNumber);
                        cst.execute();
                        cst.close();
    //                    String query2 = "UPDATE vstd_media_cat_attributes " +
    //                                      "SET sort_sequence = (sort_sequence + 1 ) " +
    //                                      "WHERE catalogue=:1 sort_sequnce >=:2 AND sort_sequence <:3";
    //                    PreparedStatement ps2;
    //                    ps2 = connection.prepareStatement(query2);
    //                    ps2.setString(1, catalogue);
    //                    ps2.setInt(2, newNodeSequenceNumber);
    //                    ps2.setInt(3, freeSequenceNumber);
    //                    ps.executeUpdate();
    //                    ps.close();
                   } // end of if block
                   rs.close();
              } catch (SQLException e) {
                   e.printStackTrace();
          * This method finds the last sequence number preceding the sequence number of a node
          * that is going to be inserted. The preceding sequence number is required to calculate
          * the sequence number of the new node.
          * We perform a hierarchical query starting from the parent node: if a result is returned,
          * we assign the parent's farthest descendant's node sequence number; if no result
          * is returned, we assign the parent's sequence number.
          * @param connection
          * @param catalogue
          * @param parent_attr parent attribute of the new node
          * @return
         private int getPrecedingSequenceNumber(OracleConnection connection, String catalogue, String parent_attr) {
              int sequenceNumber = 0;
              String query = "SELECT sort_sequence FROM vstd_media_cat_attributes " +
                                "WHERE catalogue=:1 " +
                                "CONNECT BY PRIOR attribute = parent_attr START WITH parent_attr=:2 " +
                                "ORDER BY sort_sequence DESC";
              try {
                   PreparedStatement ps = connection.prepareStatement(query);
                   ps.setString(1, catalogue);
                   ps.setString(2, parent_attr);
                   ResultSet rs = ps.executeQuery();
                   if ( rs.next() ) {
                        sequenceNumber = rs.getInt("sort_sequence");
                   } else {
                        // TODO: ggf fetch from request!
                        sequenceNumber = -1;
                   rs.close();
                   ps.close();
              } catch (SQLException e) {
                   e.printStackTrace();
              return sequenceNumber;
    }

    After further googling I figured out what was causing the problem: in eclipse I was referring to external libraries located in eclipse/plugins directory, whereas Tomcat was referring to the same libraries (possibly older versions) in it's common/lib directory.

  • Solution Needed for ODI function call

    Hi Experts,
    I am using ODI 11g.
    Currently i am using oracle procedures to call a function in ODI .
    just like "Select package_name.function_name from dual " i am using this query in ODI variables.The output of the function
    i am using in ODI mails .
    So for this ..Suppose for any changes i need to go to the Oracle package and change the function logic...and then promote this
    to production ..which is a time taking for me.
    So i want to write this Function inside ODI variable and send the output to ODI mail ...So that i dont need DB side to promote
    the code to production on every changes.
    Please let me know whether this solution is good or not.
    Thanks,
    Lony

    Hi,
    under my opinion is good having all the logic inside ODI. But it depends from the complexity of the logic and the frequency of your change. If you change the logic once for year it's quite useless make this inside your ODI.
    A good compromise could be to put a package_name.function_name step in your package.

  • Function Call Syntax

    What is the proper syntax to assign the value returned from a function call to a variable when that function is called within a procedure withing a package.
    My example Procedure looks like the following :
    The function that I am calling is "FNC_CURRENT_TIME_ID" in the package "tst_UI_Queries". I have tried the following....
    PROCEDURE QRY_CURRENT_TIME_ID(o_Time_ID               int)
    IS
    BEGIN
         o_Time_ID := exec tst_UI_Queries.FNC_CURRENT_TIME_ID;
         RETURN o_Time_ID;
    END QRY_CURRENT_TIME_ID;      
    I have also tried...
    exec txt_UI_Queries.FNC_Current_TIME_ID INTO o_Time_ID;
    Does not seem to like either...
    Thanks inadvance for your assistance!!!

    IF you are assigning the return value to the o_Time_ID, which is an input parameter to the procedure QRY_CURRENT_TIME_ID, you must make it an OUT or IN OUT to be able to assign the value.

  • NiRFSA_Rea​dPowerSpec​trumF64 function call in TestStand 4.5.1 cause system error

    I am using TestStand with niRFSA.dll to call the function niRFSA_ReadPowerSpectrumF64. This function will make the NI RFSA takes a spectrum sweep and return an array of amplitudes, as well as a structure that contains the frequencies information. My teststand sequence file is attached. The sequence editor will execute this function call, and actually retrieve correct data from the RFSA, I can see all the data in the Locals variables. The data are correct. However, the sequence editor also throws out system error, with no further details.
    See the error window also attached.
    Once in a while, the sequence editor will work just fine, executing the same function call without throwing out error, this is less than 10% of the time.
    I am using this on Windows 7.
    Let me know if you have any insight.
    Attachments:
    RFSA Sequence.seq ‏7 KB
    Capture.JPG ‏33 KB

    Hi Doug:
    Yes this is what I suspected also. Since the container type was a TS custom type I created to accept the C struct from the instrument. But when the data come back from the dll is a C struct, and there lays the conflict, I think its the packaging layer semantics have some conflict, even though each of the element in the C struct matches the TS type definitions, as I received all that data correctly in TS.
    Thanks,
    Juswanto

  • Java function call from Trigger in Oracle

    Moderator edit:
    This post was branched from an eleven-year-old long dead thread
    Java function call from Trigger in Oracle
    @ user 861498,
    For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
    Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
    {end of edit, what follows is their posting}
    I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
    My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
    Trigger:
    CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
    IS LANGUAGE JAVA
    NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
    Java:
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
    // Required class libraries.
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import com.ekahau.common.sdk.*;
    import com.ekahau.engine.sdk.*;
    // Define class.
    public class ThrowAnError {
    // Connect and verify new insert would be a duplicate.
    public static void contactTrigger(Integer memberID) throws Exception {
    String badgeId;
    // Create a Java 5 and Oracle 11g connection.
    Connection conn = DriverManager.getConnection("jdbc:default:connection:");
    // Create a prepared statement that accepts binding a number.
    PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
    "FROM Users " +
    "WHERE \"User\" = ? ");
    // Bind the local variable to the statement placeholder.
    ps.setInt(1, memberID);
    // Execute query and check if there is a second value.
    ResultSet rs = ps.executeQuery();
    while (rs.next()) {
    badgeId = rs.getString("Note");
    // Clean up resources.
    rs.close();
    ps.close();
    conn.close();
    // davids badge is 105463705637
    EConnection mEngineConnection = new econnection("10.25.10.5",8550);
    mEngineConnection.setUserCredentials("choff", "badge00");
    mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
    mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
    Edited by: rukbat on May 31, 2011 1:12 PM

    To followup on the posting:
    Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
    Having figured that out on my own, I minified my code to just run the one line of code:
    // Required class libraries.
      import java.sql.*;
      import oracle.jdbc.driver.*;
      import com.ekahau.common.sdk.*;
      import com.ekahau.engine.sdk.*;
      // Define class.
      public class ThrowAnError {
         public static void testEkahau(Integer memberID) throws Exception {
         try {
              EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
         } catch (Throwable e) {
              System.out.println("got an error");
              e.printStackTrace();
    }So, after the following:
    SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
    and the following as the user
    SQL> set serveroutput on
    SQL> exec dbms_java.set_output(10000);
    I run the procedure and receive the following message.
    SQL> call java_contact_t4(801);
    got an error
    java.lang.NoClassDefFoundError
         at ThrowAnError.testEkahau(ThrowAnError:13)
    Call completed.
    NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
    Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
    c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
    arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
    creating : resource META-INF/MANIFEST.MF
    loading : resource META-INF/MANIFEST.MF
    creating : class com/ekahau/common/sdk/EConnection
    loading : class com/ekahau/common/sdk/EConnection
    creating : class com/ekahau/common/sdk/EErrorCodes
    loading : class com/ekahau/common/sdk/EErrorCodes
    skipping : resource META-INF/MANIFEST.MF
    resolving: class com/ekahau/common/sdk/EConnection
    skipping : class com/ekahau/common/sdk/EErrorCodes
    skipping : class com/ekahau/common/sdk/EException
    skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
    skipping : class com/ekahau/common/sdk/EMsg
    skipping : class com/ekahau/common/sdk/EMsgEncoder
    skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
    skipping : class com/ekahau/common/sdk/EMsgProperty
    resolving: class com/ekahau/engine/sdk/impl/LocationImpl
    skipping : class com/ekahau/engine/sdk/status/IStatusListener
    skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
    Classes Loaded: 114
    Resources Loaded: 1
    Sources Loaded: 0
    Published Interfaces: 0
    Classes generated: 0
    Classes skipped: 0
    Synonyms Created: 0
    Errors: 0
    .... with no explanation.
    Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
    How do i get it to resolve the entire jar file?
    Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
    Edited by: themadprogrammer on Aug 5, 2011 7:26 AM

  • UDPWrite in a loop. "A Windows Sockets function call returned an unexpected error."

    Hello together,
    i use UDP Support Library in NI CVI 9.0. When i wait for receiving a packet at the pc to send then a packet from the pc, the functions UDPRead and UDPWrite work fine. If i want to test the maximum throughput, i put the UDPWrite in a loop, but then an error occurs. It is "kUDP_UnexpectedWinsockError"
    Error Popup:
    "NON-FATAL RUN-TIME ERROR:   "main.c", line 53, col 22, thread id
    0x00000C18:   Library function error (return value == -6822
    [0xffffe55a]). A Windows Sockets function call returned an unexpected
    error."
    Line 53:
    status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
    the whole loop:
    while(1)
    status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
    counter++;
    if(counter>50)
    break;
    else{;}
    The error occurs after 3-16 packets have been sent. If i step through the programm, no error occurs. So i guess its because the UDPWrite command is invoked too fast. pOutputBuffer has static data. I could use a delay in the loop, but then i dont know how to configure for maximal throughput.
    Any ideas how to avoid this error?
    Regards Florian

    Hello and thank you for your answer. Sorry that i reply a month later.
    I dont know what you mean by "let 'er rip approach". Do you mean something like:
    status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
    if(status==0)
     counter++;
    else
      Delay(0.00005);
    I did not yet try to put the packet number in the payload, but there is just a 30 cm crossover cable between the two devices, no switch, no router. So the sequence should not be interruptet. And even if they arrive in chaos, i dont mind.
    I have contacted the NI support 2 weeks ago, but no response yet.
    I did some tests with a delay between the execution of UDPWrite(). The code:
    float time = 0.0;
     for(i = 1; i < 1000; i++)
      status = UDPWrite (channel, 60100, "192.168.1.10", pOutputBuffer, 1458);
      time = 1.0 / i;
      Delay(time);
    The results:
    For i between 1 and 1000: no error, the speed of the last ten packets was about 6.5 MBit/s
    For i between 1000 and 2000: error occured at i = 1585 (variable time in Delay was 0.0006313), the speed of the last ten packets was about 8 MBit/s
    Then i put some constant values in Delay and ran 100 UDPWrite iterations:
    Delay(0.0006): 7.48 MBit/s
    Delay(0.0001): 10.7 MBit/s
    Delay(0.00001): error occured at i=31, speed of 31 packets was 12.0 MBit/s
    Delay(0.00008): 100 of 100 packets, speed 10.9 MBit/s
    Delay(0.00005): error at i=41, speed of 41 packets 11.1 MBit/s

  • Erreur R6025 "pure virtual function call"

    Bonjour
    Ci-joint un Vi labview, crée par Signal express. Fonctionnent pendant 24h, puis erreur : R6025, Pure virtual function call .
    On clique sur OK, puis fermeture de LABVIEW.
    Ce programme, doit enregistrer 24/24 des mesures qui sont stockées dans des variables partagées.
    Ces variables partagées sont remplies par un autre Vi d'acquisition.
    Attachments:
    Neutronique Harchivage.vi ‏301 KB

    Bonjour,
    L'erreur R6025 est une erreur Windows qui semble liée à des problèmes réseaux ou des paramètres Windows.
    Vous pouvez essayer ces quelques solutions :
    - désactiver le Firewall,
    - désactiver les anciennes version du Run-Time Engine de LabVIEW.
    Pour nous aider à mieux comprendre votre problème, voici quelques questions supplémentaires :
    - Quelle version de LabVIEW et de SignalExpress avez-vous? Quelle version de Windows ?
    - Est-ce qu'une mise à jour de Windows a eu lieu au moment de l'erreur ou dans les jours avant le lancement du programme?
    - Est-ce que le programme a déjà fonctionné ?
    Cordialement,
    Charlotte F. | CLAD
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> "Du 11 octobre au 17 novembre, 2 sessions en parallèle : bien démarrer - approfondir vos connais...

  • R 6025 pure virtual Function Call

    Hello, I'm having trouble with my Premiere elemnts 12, to start the message - R 6025 pure virtual Function Call - Exception Unknown Software Exception (0x400000015) in 0x78b2d6fd. My system is XP pac 3. I tried to find the solution but I found .Agradeço who can guide me, thanks.

    I bought the license in January / 2014 package with Adobe Premiere / Photoshop Elements, and sent me for download. Was functioning normally and is only now that had this error. My XP SP3 32-bit Pentium Dual Core E 6500 2.93 GHz, 2 GB RAM and 300 GB of free space. The original anti virus is Kaspersky Internet Security and have the latest version of Quick Time. I have made many times the procedure to uninstall - CCleanner - reinstall. I do not understand "let us try creating a new User Account with Administrative Privileges and installing and running Premiere Elements 12 / 12.1 from this new account." Thank you.

  • Oracle function call from XSQL

    Hi, Steve,
    We have trouble to make a function call in XSQL. Here is what we have.
    Function:
    create or replace function VerifyUser (valid in varchar2)
    return varchar2
    is
    begin
    return(valid);
    end;
    XSQL call:
    <PAGE xmlns:xsql="urn:oracle-xsql" connection="demo" istrue="ISTRUE">
    <xsql:query>
    select VerifyUser('{@istrue}') from DUAL
    </xsql:query>
    </PAGE>
    Error message returned:
    <PAGE istrue="ISTRUE">
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Invalid character in name.</ERROR>
    </PAGE>
    Any idea what is wrong here?
    What we want is to get the out variable value onto the XSQL page.
    Thanks for help.
    null

    You'll need to provide a column alias for the function call:
    select func(val) as alias from dual

Maybe you are looking for

  • Opening pdf files on websites to fill them in on the website

    With my iMac I can open and fill in all pdf files from websites using OSX 10.6.5.  On my macbook pro using 10.7.5  or later safari will no longer open pdf files on websites and just gives you a blank black page.  I use these all the time on sites fro

  • Can i keep files into my time capsule and delete them from my mac?

    i have to many files in my mac and i'm running out of space so i want to put the photos and music only on my time capsule and delete them from my mac, is that possible?

  • View pdf through ole

    Hi! i am using ole to display PDF file in form6. using this code on when button pressed DECLARE item_id ITEM; item_name VARCHAR(25) := 'OLEITEM'; BEGIN item_id := Find_Item(item_name); IF Id_Null(item_id) THEN message('No such item: '||item_name); EL

  • Need information aboout Oracle Cloud Computing.

    Hi, I need to prepare the Oracle Cloud Computing solution for Iaas(Infrastucture). Can some body provide me the information or pointer from where i can get the information. Can some body let me know if I want to use cloud computing for Infrastucture.

  • Html in a frame

    hi, is it possible to have an application who is showing html-pages in an internalFrame or so ??? Kevin