Call function pipeline with entry as a record of cursor type parameter
HelloI want result set of query curosr to function in pipeline and then proceed to Ref cusror for java application. I wrote the code below:
CREATE OR REPLACE PACKAGE emp_pkg IS
TYPE t_emp_rec IS RECORD(empid varchar2(5),last_name varchar2(25),email varchar2(25));
type obj_t_emp_rec is table of t_emp_rec;
CURSOR get_emp_data_cur(empid IN employee.employee_id%type)
IS
SELECT EMPLOYEE_ID,LAST_NAME,EMAIL
FROM employee
WHERE employee_id=empid;
--Rowtype for table
TYPE t_emp IS TABLE OF get_emp_data_cur%ROWTYPE INDEX BY PLS_INTEGER;
--Object for the table type created
get_emp_rec t_emp;
PROCEDURE Populate_emp_details(empid IN employee.employee_id%type,get_emp_rec OUT t_emp, result out sys_refcursor);
function type_out(get_emp_rec in t_emp) return obj_t_emp_rec pipelined;
END emp_pkg;
/
CREATE OR REPLACE PACKAGE BODY emp_pkg AS
PROCEDURE Populate_emp_details(empid IN employee.employee_id%type,get_emp_rec OUT t_emp,result out sys_refcursor)
IS
BEGIN
SELECT EMPLOYEE_ID,LAST_NAME,EMAIL
BULK COLLECT
INTO get_emp_rec
FROM employee
WHERE employee_id=empid;
open result for SELECT * FROM TABLE (type_out(get_emp_rec));
EXCEPTION
when no_data_found then
dbms_output.put_line('Invalid booking number entered');
END Populate_emp_details;
function type_out(get_emp_rec in t_emp) return obj_t_emp_rec pipelined
as
currec t_emp_rec;
begin
for i in 1..get_emp_rec.count loop
pipe row(currec);
dbms_output.put_line('row count of rec -'|| get_emp_rec.count);
end loop;
end;
END emp_pkg;
/
It gives me compilation error when you call the function pipeline (type_out (get_emp_rec)). Is it wrong to call pipelined function or please correct where I'm wrong.Help, please.
Thank you
Engine SQL doesn't know PL/SQL types.
Really? :
SQL> create or replace package emp_pkg
is
type t_emp_rec is record
(
empid varchar2 (5),
last_name varchar2 (25),
email varchar2 (25)
);
type obj_t_emp_rec is table of t_emp_rec;
cursor get_emp_data_cur (empid in employees.employee_id%type)
is
select employee_id, last_name, email
from employees
where employee_id = empid;
--Rowtype for table
type t_emp is table of get_emp_data_cur%rowtype;
get_emp_rec t_emp;
procedure populate_emp_details (empid in employees.employee_id%type);
function type_out (empid in employees.employee_id%type) return obj_t_emp_rec pipelined;
end emp_pkg;
/
Package created.
SQL> create or replace package body emp_pkg
as
function type_out (empid in employees.employee_id%type)
return obj_t_emp_rec pipelined
as
currec t_emp_rec;
begin
populate_emp_details (empid);
for i in 1 .. get_emp_rec.count
loop
currec.empid := get_emp_rec(i).employee_id;
currec.last_name := get_emp_rec(i).last_name;
currec.email := get_emp_rec(i).email;
pipe row (currec);
--dbms_output.put_line ('row count of rec -' || get_emp_rec.count);
end loop;
return;
end type_out;
procedure populate_emp_details (empid in employees.employee_id%type)
is
begin
select employee_id, last_name, email
bulk collect into get_emp_rec
from employees
where employee_id = empid;
end populate_emp_details;
end emp_pkg;
/
Package body created.
SQL> select * from table(emp_pkg.type_out(114))
/
EMPID LAST_NAME EMAIL
------- ------------------------------------- -------------------------------------
114 Raphaely DRAPHEAL
1 row selected.
;)
Tags: Database
Similar Questions
-
I want to copy documents from my hard drive on a USB 2.0 flash drive but I get an error message that the files are "write-protected" and may not be copied (?). I tried to change settings in the registry, but do not see the "StorageDevicePolicies" to change the setting.
Any suggestions?
similar to the little switch that old diskettes of 3 " ;
some flash drives also have a small switch on them which can enable or disable "write protection" on them.
-
How to call a form with splashing around by clicking on a record with a time where
Hi all
How to call a form with splashing around by clicking on a record with a time where clause. I mean when I dip, click current record I want to call another form with the details of the
record with onetime where clause. Can someone help me in this regard.
Now, I'll call you a form with parameter with where Jadi but this should be avoided.
Thanks in advance
ArifMaybe this helps http://andreas.weiden.orcl.over-blog.de/article-28180655.html
-
How to call a function plugin with command line parameters
I wrote a plugin that processes an open document. The treatment can be started by selecting a menu item in Acrobat. To start the processing of the command line, I also wrote a small Visual Basic executable file that currently a bit activates the menu command. However, I now have to pass some parameters to the plugin. I managed to call a function plugin with settings by loading the .api as a library file in the VB executable. But it seems that the entire Acrobat SDK functionality is not initialized in this way. So I can't work with the PDF file. How can I call my function plugin with settings in Acrobat? Thomas
You must establish a form of IAC (communication monitor) of your VB application with your plugin.
Whether COM, DDE, IPC, named pipes, shared memory files share, etc. is to you...
-
How to call a stored procedure with a REF CURSOR output parameter
I'm looking forward to example calling a function/stored procedure with a REF CURSOR output parameter and get the result.
In other words, I have a stored function/procedure that runs a SELECT statement using the OCI library and then he could get the values of each row and each column.
I put a code snippet, it have only the main thing to call a simple stored procedure and to print the name of each column of the cursor, but I couldn t to print out values in the table that calls the stored procedure.
I understand that the next step is to call an OCIStmtFetch.
How to associate the slider with the OCIStmtFetch?
If you need more information, just tell me.
I use ANSI C with HP - UX (HP - UX C) operating system and Oracle 10 g.
Kind regards.
Antonio Garcia
/ * callOracleSP * /.
#include < stdio.h >
#include < string.h >
#include < oci.h >
#include < stdlib.h > to
char * pConnectChar = "Server";
char * pUsernameChar = "user";
char * pPasswordChar = "passwd";
char * sqlCharArray1 = "BEGIN SP_GETCITIES (:,: c); END; « ;
int retval;
UB4 parmcnt = 0;
UB4 pos2 = 0;
text * pcoln [20];
UB4 namelen [20];
char state_key [5];
OCIStmt * pOciStatement;
OCIStmt * pOciStatCursor;
OCIError * pOciError;
OCIEnv * pOciEnviron;
OCIServer * pOciServer;
OCISession * pOciSession;
OCISvcCtx * pOciServiceContext;
OCIBind * pOciBind [500];
OCIParam * pOciParam;
int main()
{
retval = OCIEnvCreate (& pOciEnviron, OCI_DEFAULT, NULL, NULL, NULL, NULL, 0, NULL);
retval = OCIEnvInit (& pOciEnviron, OCI_DEFAULT, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciError, OCI_HTYPE_ERROR, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatement, OCI_HTYPE_STMT, 0, NULL);
retval = OCILogon (pOciEnviron, pOciError, & pOciServiceContext,(unsigned char *) pUsernameChar,
strlen (pUsernameChar), (unsigned char *) pPasswordChar, strlen (pPasswordChar).
(unsigned char *) pConnectChar, strlen (pConnectChar));
printf ("retval=%d\n",retval OCILogon);
retval = OCIStmtPrepare (pOciStatement, pOciError, (unsigned char *) sqlCharArray1, strlen (sqlCharArray1),)
OCI_NTV_SYNTAX, OCI_DEFAULT);
printf ("StmtPrepare retval=%d\n",retval);
retval = OCIHandleAlloc (pOciEnviron, (void *) & pOciStatCursor, OCI_HTYPE_STMT, 0, NULL);
retval = 1 OCIBindByPos(pOciStatement,&pOciBind[0], pOciError, (ub4), (void *) & state_key,)
((sb4) sizeof (state_key), SQLT_STR, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
retval = OCIBindByPos(pOciStatement,&pOciBind[1], pOciError, (ub4) 2, (void *) & pOciStatCursor,)
((sb4) 0, SQLT_RSET, (void *) 0, (ub2 *) 0, (ub2 *) 0, (ub4) 0, (ub4 *) 0, OCI_DEFAULT (ub4));
printf ("BindByPos OCI_HTYPE_STMT retval=%d\n",retval);
strcpy (state_key, 'ca');
retval = OCIStmtExecute (pOciServiceContext, pOciStatement, pOciError, (ub4) 1, (ub4) 0,)
(OCISnapshot *) NULL, (OCISnapshot *) NULL, OCI_DEFAULT (ub4));
printf ("StmtExecute retval=%d\n",retval);
/ * How to get the values of the cursor? */
/ * Number of parameters of the cursor * /.
OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & parmcnt,(ub4 *) 0,)
(ub4) (OCI_ATTR_PARAM_COUNT, pOciError);
printf ("\nNumber of the slider settings = %d\n",parmcnt);
for (int pos = 1; pos < = (int) parmcnt; pos ++)
{
OCIAttrGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), (void *) & pos2,(ub4 *) 0,)
(ub4) (OCI_ATTR_CURRENT_POSITION, pOciError);
retval = OCIParamGet ((void *) pOciStatCursor, OCI_HTYPE_STMT (ub4), pOciError, (void *) & pOciParam,)
POS (ub4));
OCIAttrGet pOciParam, (ub4) ((void*) OCI_DTYPE_PARAM,(void*) & pcoln [pos - 1],(ub4 *) & namelen [pos-1],)
(ub4) OCI_ATTR_NAME,(OCIError *) pOciError);
}
for (int i = 1; i < = (int) parmcnt; i ++)
printf ("%i\tNAME = % column. ("* s\n", i, namelen [i-1], pcoln [i-1]);
return 0;
}
This is the script that create the table, insert records and create the stored procedure
CREATE TABLE CITIES)
STATE_CODE VARCHAR2 (2) NULL,
CITY_CODE NUMBER (15.5) NULL,
CITY_NAME VARCHAR2 (30) NULL
)
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 30, 'SAN DIEGO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 40 'SACRAMENTO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('FL', 10, 'MIAMI')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('FL', 20, 'ORLANDO')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('NEW YORK', 10, 'NEW YORK')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('NEW YORK', 20, 'ALBANY')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 10, 'LOS ANGELES')
/
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES ('CA', 20, 'SAN FRANCISCO')
/
CREATE or REPLACE PACKAGE globalPkg AUTHID CURRENT_USER AS
/ * The following is specific global variables T/SQL. */
TYPE RCT1 IS REF CURSOR; / * new cursor low definition * /.
END globalPkg;
/
CREATE OR REPLACE PROCEDURE SP_ADDCITY)
P_STATE_CODE IN VARCHAR,
P_CITY_CODE NUMBER,
P_CITY_NAME IN VARCHAR2,
P_RETURN IN NUMBERS)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2 (255);
BEGIN
StoO_rowcnt: = 0;
StoO_error: = 0;
StoO_selcnt: = 0;
P_RETURN: = 0;
INSERT INTO CITIES (STATE_CODE, CITY_CODE, CITY_NAME)
VALUES (P_STATE_CODE, P_CITY_CODE, P_CITY_NAME);
StoO_rowcnt: = number of LINES SQL %;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
StoO_rowcnt: = 2;
WHILE OTHERS THEN
StoO_rowcnt: = 0;
StoO_selcnt: = 0;
StoO_error: = SQLCODE;
StoO_errmsg: = SQLERRM;
IF StoO_error! = 0 THEN
BEGIN
P_RETURN: = 1;
RETURN;
END;
END IF;
END;
/
CREATE OR REPLACE PROCEDURE SP_GETCITIES)
STATE_KEY IN VARCHAR,
RC1 IN OUT globalPkg.RCT1)
AS
StoO_error INTEGER;
StoO_selcnt INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2 (255);
BEGIN
StoO_rowcnt: = 0;
StoO_error: = 0;
StoO_selcnt: = 0;
OPEN FOR RC1
SELECT STATE_CODE, CITY_CODE, FRANCISCO
CITIES
WHERE STATE_CODE = STATE_KEY
ORDER BY CITY_CODE;
StoO_rowcnt: = number of LINES SQL %;
EXCEPTION
WHILE OTHERS THEN
StoO_rowcnt: = 0;
StoO_error: = SQLCODE;
StoO_errmsg: = SQLERRM;
END;
/Hi Antonio,.
I see this:
c_buf=(ub1 **)calloc(sizeof(ub1 *),3); ... rc=OCIDefineByPos(pOciStatCursor,&pdef,(OCIError *)pOciError,pos,c_buf[pos-1],size+1,(ub2)type,(dvoid *)c_indp[pos-1],(ub2 *)0,(ub2 *)0,OCI_DEFAULT);
That I don't understand. You allocate space for 3 pointers ub1 but I don't see where these pointers are then initialized to point to where the data is to be stored.
I do not read correctly?
Sorry for posting code long, but here is an example of code that I have. It is much more 'code' for your code, but maybe that will be enough...
NOTE: This is just the code example and not rigorous. For example, I don't check the memory, allocations etc in this code!
Kind regards
Mark
#ifdef WIN32 #define _CRT_SECURE_NO_DEPRECATE 1 #endif #include
#include #include #include void checkerr(sword status, OCIError *errhp); int main(int argc, char *argv[]) { OCIEnv *envhp = NULL; /* OCI Environment handle */ OCIError *errhp = NULL; /* OCI Error handle */ OCISvcCtx *svchp = NULL; /* OCI Service Context handle */ OCIServer *srvhp = NULL; /* OCI Server handle */ OCISession *usrhp = NULL; /* OCI User Session handle */ OCIStmt *stmtp = NULL; /* OCI Statement handle */ OCIStmt *cursr = NULL; /* OCI Statement handle */ OCIParam *prmp1 = NULL; /* OCI Parameter handle */ OCIParam *prmp2 = NULL; /* OCI Parameter handle */ OCIParam *prmp3 = NULL; /* OCI Parameter handle */ OCIDefine *defp1 = NULL; /* OCI Define handle */ OCIDefine *defp2 = NULL; /* OCI Define handle */ OCIDefine *defp3 = NULL; /* OCI Define handle */ OCIBind *bndp1 = NULL; /* OCI Bind handle */ OCIBind *bndp2 = NULL; /* OCI Bind handle */ OCIBind *bndp3 = NULL; /* OCI Bind handle */ /* used to hold column width */ ub2 col_width; /* used to set the prefetch count */ ub4 prefetch_count = 32; /* will hold output from database */ oratext *pEmpId = NULL; oratext *pFirstName = NULL; oratext *pLastName = NULL; /* the anonymous block to execute */ /* this opens a ref cursor */ oratext *sqlstmt = "begin " \ " open :1 for " \ " select to_char(employee_id), " \ " first_name, " \ " last_name " \ " from hr.employees " \ " order by last_name, " \ " first_name; " \ "end;"; /* used to hold the results of each OCI call */ sword result = 0; /* Initialize and create a default environment */ result = OCIEnvCreate(&envhp, OCI_DEFAULT, (dvoid *) 0, 0, 0, 0, (size_t) 0, (dvoid **) 0); /* allocate an error handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &errhp, OCI_HTYPE_ERROR, 0, (dvoid **) 0); /* allocate a service context handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &svchp, OCI_HTYPE_SVCCTX, 0, (dvoid **) 0); /* allocate a server handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &srvhp, OCI_HTYPE_SERVER, 0, (dvoid **) 0); /* allocate a user session handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &usrhp, OCI_HTYPE_SESSION, 0, (dvoid **) 0); /* create a server context using the "ORADEMO" database */ result = OCIServerAttach(srvhp, errhp, "ORADEMO", (ub4) strlen("ORADEMO"), OCI_DEFAULT); /* set the server attribute in the service context handle */ result = OCIAttrSet((dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *) srvhp, (ub4) 0, OCI_ATTR_SERVER, errhp); /* open the session with the database */ /* using external authentication */ result = OCISessionBegin(svchp, errhp, usrhp, OCI_CRED_EXT, OCI_DEFAULT); /* set the user session attribute in the service context handle */ result = OCIAttrSet((dvoid *) svchp, OCI_HTYPE_SVCCTX, (dvoid *) usrhp, (ub4) 0, OCI_ATTR_SESSION, errhp); /* allocate the statement handle */ result = OCIHandleAlloc((dvoid *) envhp, (dvoid **) &stmtp, OCI_HTYPE_STMT, 0, (dvoid **) 0); /* prepare the statement for execution */ result = OCIStmtPrepare(stmtp, errhp, sqlstmt, (ub4) strlen((char *) sqlstmt), OCI_NTV_SYNTAX, OCI_DEFAULT); /* allocate the handle for the ref cursor */ result = OCIHandleAlloc((dvoid *) envhp, (void **) &cursr, OCI_HTYPE_STMT, 0, NULL); /* bind the ref cursor parameter */ result = OCIBindByPos(stmtp, &bndp1, errhp, 1, &cursr, 0, SQLT_RSET, NULL, 0, NULL, 0, 0, OCI_DEFAULT); /* execute the statement */ result = OCIStmtExecute(svchp, stmtp, errhp, 1, 0, NULL, NULL, OCI_DEFAULT); /* get parameter descriptor for first column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp1, (ub4) 1); /* get parameter descriptor for second column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp2, (ub4) 2); /* get parameter descriptor for third column */ result = OCIParamGet((dvoid *) cursr, OCI_HTYPE_STMT, errhp, (dvoid **) &prmp3, (ub4) 3); /* get the first column width in characters */ result = OCIAttrGet((dvoid*) prmp1, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pEmpId = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the first column in the results */ result = OCIDefineByPos(cursr, &defp1, errhp, 1, (dvoid *) pEmpId, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* get the second column width in characters */ result = OCIAttrGet((dvoid*) prmp2, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pFirstName = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the second column in the results */ result = OCIDefineByPos(cursr, &defp2, errhp, 2, (dvoid *) pFirstName, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* get the third column width in characters */ result = OCIAttrGet((dvoid*) prmp3, (ub4) OCI_DTYPE_PARAM, (dvoid*) &col_width, (ub4 *) 0, (ub4) OCI_ATTR_DATA_SIZE, errhp); /* allocate memory to hold the result */ pLastName = (oratext *) malloc(sizeof(oratext) * (col_width + 1)); /* define the third column in the results */ result = OCIDefineByPos(cursr, &defp3, errhp, 3, (dvoid *) pLastName, (sword) col_width + 1, SQLT_STR, (dvoid *) NULL, (ub2 *) 0, (ub2 *) 0, OCI_DEFAULT); /* loop through and print the results */ while ((result = OCIStmtFetch(cursr, errhp, (ub4) 1, (ub2) OCI_FETCH_NEXT, (ub4) OCI_DEFAULT)) == OCI_SUCCESS) { printf("Employee ID: %s\n", pEmpId); printf(" First Name: %s\n", pFirstName); printf(" Last Name: %s\n\n", pLastName); } /* free allocated memory */ free(pEmpId); free(pFirstName); free(pLastName); pEmpId = NULL; pFirstName = NULL; pLastName = NULL; /* terminate the session with the database */ result = OCISessionEnd(svchp, errhp, usrhp, OCI_DEFAULT); /* detach from the server */ result = OCIServerDetach(srvhp, errhp, OCI_DEFAULT); /* deallocate the environment handle */ /* OCI will deallocate the child handles */ result = OCIHandleFree((dvoid *) envhp, OCI_HTYPE_ENV); return OCI_SUCCESS; } void checkerr(sword status, OCIError *errhp) { oratext errbuf[512]; sb4 errcode = 0; switch (status) { case OCI_SUCCESS: break; case OCI_ERROR: case OCI_SUCCESS_WITH_INFO: (void) OCIErrorGet((dvoid *) errhp, (ub4) 1, (oratext *) NULL, &errcode, errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); (void) printf("Error: %.*s\n", sizeof(errbuf), errbuf); break; case OCI_NEED_DATA: (void) printf("Error - OCI_NEED_DATA\n"); break; case OCI_NO_DATA: (void) printf("Error - OCI_NO_DATA\n"); break; case OCI_INVALID_HANDLE: (void) printf("Error - OCI_INVALID_HANDLE\n"); break; case OCI_STILL_EXECUTING: (void) printf("Error - OCI_STILL_EXECUTING\n"); break; case OCI_CONTINUE: (void) printf("Error - OCI_CONTINUE\n"); break; default: break; } } -
Activation of calling function WhatsApp
So I was wondering if anyone of you guys have the calling function enabled on whatsapp and if could you please call me to activate it? Then PM me and I will reply with my number, I'm not posting here cos I don't want the world to see that it
So I finally managed to get calls on WhatsApp! I had to uninstall the version of WhatsApp page and install one of the playstore. If you do that and you receive a call (or if you have received a call) the feature must be activated
-
Unexpected behavior first LV call function called VI.
Hello
I call a VI that has the first call internal ventricular function. It works as expected when I run the sequence of the first time. However, when I run the sequence for the second time, First Call function returns 'false', when I run this VI for the first time. Expected value is 'true '.
Why?
I use the default options for loading and unloading. I played with the options of unloading in the property Options running, but futile.
What should I do to make it work because I expect?
-
Stuck to calling function c ++ QML
Hello
I am a newbie in QML. While playing with examples, I tried calling function c ++ QML.
hand. QML is-
import bb.cascades 1.0 Page { Container { layout: StackLayout { } Label { text: _foo.sayHello(); } } }
c ++ is
//say Hello QString foo::sayHello() { QString hello = "Hello!"; return hello; }
But my program does not say hello. What's wrong?
Could you show the function declaration and the way in which the class is exported to QML?
The function must be declared as Q_INVOKABLE.Check the logs of apparatus for run time errors may also give a clue.
-
Question: How can I call function of MC in the first image of the stadium?
Example:
First MC: ToggleButton have the function:
function setSelected (b)
{
selected = b;
If (selected)
_this.gotoAndStop ("DN");
on the other
_this.gotoAndStop ("up");
}
This code working fine inside MC...
This place of button on the stage with the instance name: btn_mc
When I write Action in the first image of the stage: this.btn_mc.setSelected (true) in the output window of the browser, I got an error message: setSelected is not a function.
You must declare the function to make it accessible. Try this inside the movieclip:
setSelected var = setSelected;
function setSelected (b)
{
selected = b;
If (selected)
_this.gotoAndStop ("DN");
on the other
_this.gotoAndStop ("up");
}
Then, it should work out the movieclip:
This. ToggleButton.setSelected (true);
-
I get this error message with IE, version 8 upwards. The message appears once you navigate to another page on the site and then return to the home page. Can anyone offer advice on how to solve it? As the cursor on the site doesn't seem to work with IE, we wonder if that's where the whole issue.
The site is hosted in British Colombia and is http://www.improvementservice.org.UK
Thanks in advance.
Martin.
Hi Martin,
Could you please try some steps here.
MuseJSAssert: Error calling function of selection: [Object Error]
-
Cannot call function AS3 from JavaScript
Hello
I am trying to call a function in ActionScript 3 with JavaScript. The problem that I can't get one of the browsers to trigger this AS3 function. Debuggers to say that the function is not defined when I call on the flash object.
What is supposed to happen is - the javascript function calls the AS3 function and passes an integer value. This integer is then used to remove one of the 20 funds sovereigns and load that into the flash movie.
Please let me know if you can think of everything I can do to make it work! I've been blocked for hours and can't seem to get there.
Here are my actionScript:
import flash.net.URLRequest;
import flash.display.Loader;
to import flash.external.ExternalInterface;
var movies: Array = ["idle - ok.swf ',"idle - good .swf"];
First, it loads it "Hello swf»
var helloLoader:Loader = new Loader();
var helloURL:URLRequest = new URLRequest ("idleAvatar.swf");
helloLoader.load (helloURL);
addChild (helloLoader);
var setAvatar:Function = loadAvatar;
ExternalInterface.addCallback("IsStatic",IsStatic) ("callSetAvatar", setAvatar);
Then, this function must be called by JavaScript to load one of the other sovereign wealth funds.
function loadAvatar(indx:Number) {}
var url: URLRequest = new URLRequest(movies[0]);
var ldr:Loader = new Loader();
LDR. Load (URL);
addChild (ldr);
}
Here's my JavaScript:
"<script type="text/javascript"> ".
function callExternalInterface (val) {}
document.getElementById("loader").callSetValue (val);
}
< /script >Here is my embed code:
<div >
"" " <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="250" height="350" id="charger" name="loader"> .
" <param name="movie" value="loader.swf"/ >
" <param name="allowscriptaccess" value="always"/ >
<!--[if ! IE] >->
"" <by typeobject = "application/x-shockwave-flash" data= "loader.swf" width= "250" height= "350" > ""
" <param name="allowscriptaccess" value="always"/ >
<!-<! [endif]-->
" <a href="http://www.adobe.com/go/getflashplayer_fr"> ".
" <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player"/ >
</a>
<!--[if ! IE] >->
< /object >
<!-<! [endif]-->
< /object >
</div>
"<a href="#" onClick="callExternalInterface (1)' >click ON < /a > ""You don't appear to be calling any function in your actionscript code. Names between and inside are in disagreement.
document.getElementById("loader").callSetValue (val);
must call a function identified by the string "callSetValue" in your actionscript code, but you only have an identified with "callSetAvatar" and the function associated with the one on your side AS3 is specified as setAvatar...
ExternalInterface.addCallback("IsStatic",IsStatic) ("callSetAvatar", setAvatar);
but you do not have a function named setAvatar, you have a named loadAvatar
Here is a link to a tutorial that can help you see how the functions are specified between actionscript and javascript using the ExternalInterface class. He becomes confused, I suggest that you copy the code into a word processing file, so you can put clear where they have the same language between them.
http://Viget.com/inspire/bi-directional-ActionScript-JavaScript-communication
-
Hi all
I have a bunch that I'm trying to call a function of my procedure and I get null in my results.
If I run the function only parameter passing works very well.
It is an example of code:
get_region give me a line with multiple values.create or replace package demo as TYPE v_GetResultSet is REF CURSOR; TYPE CUSTOM_REF_CURSOR IS REF CURSOR; function get_region(my_id in Number) return GetResultSet; procedure get_country(p_id in Number, v_cursor IN OUT CUSTOM_REF_CURSOR) ; end; / create or replace package body demo as function get_region(my_id) return v_GetResultSet is v_cursor v_GetResultSet; begin open v_cursor for select region_id, region_name from countries where country_id = my_id; return v_cursor; EXCEPTION WHEN OTHERS THEN raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM); end; procedure get_country(p_id in Number, v_cursor IN OUT CUSTOM_REF_CURSOR) as begin open v_cursor for select country_name, case region_id when 3 then get_region(3) end; from countries where country_id = p_id; EXCEPTION WHEN OTHERS THEN raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM); end; end;
Any ideas?
Thank you
JohnnyHi Johnny,.
Glad to see you had a go at the objects yourself.
Here is a more complete example for look you...
SQL> create or replace type t_dept as object(dname varchar2(20), loc varchar2(20)) 2 / Type created. SQL> SQL> create or replace package test_pkg as 2 function get_dept(p_deptno in number) return t_dept; 3 function get_emp(p_empno in number) return sys_refcursor; 4 procedure show_emp(p_empno in number); 5 end; 6 / Package created. SQL> SQL> create or replace package body test_pkg as 2 function get_dept(p_deptno in number) return t_dept is 3 v_dept t_dept := t_dept(null,null); 4 begin 5 select dname, loc 6 into v_dept.dname, v_dept.loc 7 from dept 8 where deptno = p_deptno; 9 return v_dept; 10 end; 11 12 function get_emp(p_empno in number) return sys_refcursor is 13 v_rc sys_refcursor; 14 begin 15 open v_rc for 16 select empno, ename, get_dept(deptno) as dept_dets 17 from emp 18 where empno = p_empno; 19 return v_rc; 20 end; 21 22 procedure show_emp(p_empno in number) is 23 v_rc sys_refcursor; 24 v_empno number; 25 v_ename varchar2(20); 26 v_dept t_dept; 27 begin 28 v_rc := get_emp(p_empno); 29 fetch v_rc into v_empno, v_ename, v_dept; 30 close v_rc; 31 dbms_output.put_line('Empno: '||v_empno||' Ename: '||v_ename||' Dname: '||v_dept.dname||' Loc: '||v_dept.loc); 32 end; 33 end; 34 / Package body created. SQL> exec test_pkg.show_emp(7788); Empno: 7788 Ename: SCOTT Dname: RESEARCH Loc: DALLAS PL/SQL procedure successfully completed. SQL>
-
How to call functions of class Document class side
Main is my doccument class. How can I call the Main.showAlert class of the caller function.
package
{
import flash.display.Sprite;
import flash.events.Event;SerializableAttribute public class Main extends Sprite
{public void Main (): void
{
If init() (stage);
of another addEventListener (Event.ADDED_TO_STAGE, init);
}private void init(e:Event_=_null):void
{
removeEventListener (Event.ADDED_TO_STAGE, init);
entry point
}
public void showAlert() {}
trace ("called")
}}
}
////
package
{public class calling
{
public void Caller()
{
Main.showAlert)
}
}}
////change your instantiation of the appellant if you switch a display object.
package
{
import flash.display.Sprite;
import flash.events.Event;SerializableAttribute public class Main extends Sprite
{public void Main (): void
{
If init() (stage);
of another addEventListener (Event.ADDED_TO_STAGE, init);
}private void init(e:Event_=_null):void
{
removeEventListener (Event.ADDED_TO_STAGE, init);
entry point
}
public void showAlert() {}
trace ("called")
}}
}
////
package
{import flash.display.MovieClip;
public class calling
{var mainTL:MovieClip;
public void Caller(mc:MovieClip)
{mainTL = MovieClip (mc.root);
mainTL.showAlert)
}
}}
////
p.s. Please check the useful/correct.
-
call functions in parent (?) of (?) window popup
I don't know the terms parent or window in flex 4.
I want to call functions in the parent of the parent window.
It seems to be difficult.
Help me please.
Thanks in advance.
========================== index.mxml ==========================
(root element: < mx:Application >-xmlns:mx = "http://www.adobe.com/2006/mxml")
a Main.mxml inside========================== Main.mxml ==========================
(root element: < s:NavigatorContent >-xmlns:s = "library://ns.adobe.com/flex/spark")public function functInMain (): void
{
do something
}
protected function dataGrid_itemDoubleClickHandler(event:ListEvent):void
{
var arr:ArrayCollection = event.currentTarget.dataProvider;
var titleWindowInstance:Popup =
Popup (PopUpManager.createPopUp (this,
Popup,
true));
titleWindowInstance.rowData = arr.getItemAt (event.rowIndex);
PopUpManager.centerPopUp (titleWindowInstance);
}========================== Popup.mxml ==========================
protected function buttonClickedInpopup (): void
{Application.application.parentDocument.functInMain (null); / / < <-here, I want to correct
}Application.application appeal should work if the method you want to call is public.
There is also another way to do it: with a callback function.
In your pop-up:
private var _callbackFunction:Function; public function set callbackFunction( value:Function ):void { _callbackFunction = value; } protected function buttonClickedInpopup():void { _callbackFunction(null); }
And in your Main.mxml:
var titleWindowInstance:Popup = Popup(PopUpManager.createPopUp(this, Popup, true)); titleWindowInstance.rowData = arr.getItemAt(event.rowIndex); titleWindowInstance.callbackFunction = functInMain; PopUpManager.centerPopUp(titleWindowInstance);
-
Hello
I have an Employees form based on the employees table... created the get_sal function that works well... This form/block, I added a sal of text field and a button that, when pressed to call function get_sal and display value in field sal
but I'm having a problem with a kind of SEO...?Hello!
Try changing:employees.fja:=get_sal( :employee_id );
or better
:employees.fja:=get_sal( :BLOCK.employee_id );
Concerning
Maybe you are looking for
-
HDMI port is not detected on my Satellite L755-1NX
Hello I have a problem with the conector HDMI to my new laptop, I have bougth 2 weeks ago.The laptop detects no HDMI port. When I conect the laptop to a TV or monitor on a different pc, any of these detects anything. I tried to update a lot of driver
-
Compaq CQ58-d61SG: looking for Win 7 64 bit drivers for CQ58-d61SG
Hello I installed a win7 on a d61SG CQ58 that came pre-installed with win8. The laptop will now go to a customer of us who wanted to make us install win 7 on it. Now the question is, I can't find the right drivers for win7 because there just win8 dri
-
Why the total time required for the test sequence is different during the test runs
Hello -J' have different test resources to test our product which includes engines and the NOR-Box (6351). -Number of test files in sequence that are called during the test (ca. 20) -The problem is that when I run these test sequence files separate (
-
OfficeJet 7310 stopped scanning or copying
OfficeJet 7310 Windows XP SP3. When you request a copy or scan, either from the computer or the façade, the machine displays 'don't warm up' ALL DAY and no scan or copy occurs. Fully operational for printing, however. It seems that the lamp lights or
-
c4599 printer cannot find the specified file
PS_AIO_04_C4500_USW_Full_Win_WW_130_140.exe downloaded and tried to install c4599 printer. Error system cannot find the specified file "BlockSysUserInstall.exe., which is located in the Temp directory I noticed that he keeps referring to a coded ha