How to create a procedure for REF CURSOR output with any WHERE clause?
I have a requirement like this: I have a huge question that need to reuse in my code over 10 times. This SQL has about 50 lines. Here for these 10 odd times sometimes changes in WHERE clause (columns are the same). So I can't create a view as SQL is not static.I thought to write a procedure with a para of WHERE_CLAUSE entry. I pulled out a refcursor sys by adding where clause. But I can't do it because you cannot add a clause like this where clause.
i.e.
PROCEDURE dynamyic_query (p_where_clause IN VARCHAR2, p_out_query OUT SYS_REFCURSOR ) IS
BEGIN
OPEN p_out_query FOR SELECT ......... FROM table WHERE || ' ' || p_where_clause;
END;
The foregoing gives an error.How to handle such a situation? Any help would be greatly appreciated.
Hello
Channa wrote:
... However, when I change the procedure like this:PROCEDURE FORMS_TEXT_DYN_SQL_TEST(p_where_cluase IN VARCHAR2, p_out_cursor OUT SYS_REFCURSOR) IS v_stmt VARCHAR2(1000); BEGIN v_stmt := 'SELECT tname FROM tab_test WHERE tname LIKE ''%ABS_V4%'' AND :y'; OPEN p_out_cursor FOR v_stmt using p_where_cluase; END;
And run this block of code:
declare v_tname varchar2(200); out_cursor sys_refcursor; begin forms_text_dyn_sql_test(' 1 = 1 ', out_cursor ); LOOP fetch out_cursor INTO v_tname; exit when out_cursor%NOTFOUND; DBMS_OUTPUT.PUT_LINE(v_tname); END LOOP; end; /
I get the error:
[1]: (Error): ORA-00920: invalid relational operator ORA-06512: at "ABS.FORMS_TEXT_DYN_SQL_TEST", line 6 ORA-06512: at line 5
Looks like you can only set column_name =: z, column_name =: values of type y. You can not it seems to replace it with no WHERE CLAUSE?
A bind variable, such as: it, represents a single value.
If: is the VARCHAR2 '1 = 1', then
SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND :y
takes the value
SELECT tname FROM tab_test WHERE tname LIKE '%ABS_V4%' AND '1 = 1'
I think you want something like this:
CREATE OR REPLACE PROCEDURE FORMS_TEXT_DYN_SQL_TEST
( p_where_clause IN VARCHAR2
, p_out_cursor OUT SYS_REFCURSOR
) IS
v_stmt VARCHAR2(1000);
BEGIN
v_stmt := 'SELECT ename FROM scott.emp WHERE ename LIKE ''%A%'' AND '
|| p_where_clause;
OPEN p_out_cursor FOR v_stmt;
END;
/
show errors
SET SERVEROUTPUT ON
declare
v_tname varchar2(200);
out_cursor sys_refcursor;
begin
forms_text_dyn_sql_test(' 1 = 1 ', out_cursor );
LOOP
fetch out_cursor INTO v_tname;
exit when out_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_tname);
END LOOP;
end;
/
Output:
ALLEN
WARD
MARTIN
BLAKE
CLARK
ADAMS
JAMES
Tags: Database
Similar Questions
-
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; } } -
How to create an ERD for the vista sp2 x 64?
How to create an ERD for the vista sp2 x 64?
How to create an ERD for the vista sp2 x 64?
If you do not have a Microsoft Vista DVD, make a repair disc to do a Startup Repair:
Download the ISO on the link provided and make a record of repair time it starts.
Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.
At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.
When you have changed that, insert the Bootable disk you did in the drive and reboot.
http://www.bleepingcomputer.com/tutorials/tutorial148.html
Link above shows what the process looks like and a manual, it load the repair options.
NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.
Read all the info on the website on how to create and use:
http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/
ISO Burner: http://www.snapfiles.com/get/active-isoburner.html
It's a very good Vista startup repair disk.
You can do a system restart tool, system, etc it restore.
It is NOT a disc of resettlement.
Make sure you get the 64 bit version.
See you soon. Mick Murphy - Microsoft partner
-
How to create a password for the user account for my child?
How to create a password for the user account for my child?
You can create the user with the parental control account. This will act as a protection for the child's account.
You can take a look at the following links on setting up parental controls:
http://Windows.Microsoft.com/en-us/Windows/set-up-family-safety#set-up-family-safety=Windows-7
http://Windows.Microsoft.com/en-us/Windows/set-parental-controls#1TC=Windows-7
http://www.howtogeek.com/HOWTO/10524/how-to-use-parental-controls-in-Windows-7/
-
How to create the ADC for first name
Hello
I have the situation here, I need display the default in the e-mail (Dear) when the value in the first name field is less than 2 characters long or it is empty. Otherwise, I need to insert the value of the field name (Dear John).
Please let me know how to create an ADC for this.
Thank you
Rama
Use wildcards for searching.
? = any 1 character
* = 0 or any number of characters
In order to find people with more than 2 characters in this area?: *
Then, build your default rule to merge the content in case they encounter more rule of character 2.
-
How to create a shortcut for all users during installation
Hi people,
We have a desktop application that is distributed with Java Webstart and works on Win7 machines. Initially, users all connected using a connection by default, so creating shortcuts was not a problem. Now, because of new networking strategies, each user has his own connection.
The problem is that the shortcut to the application is created in the user profile (for example "C:\Users\JohnDoe\", so that other users in the same machine can not run the application unless he or she installs the application again.)
Is there a way to create this shortcut for all users using JNLP API or configuration in the xml file?
If anyone has need of the solution: during installation I save the jnlp file in a directory accessible to all the world and then start the application using "javaws path\to\file.jnlp". More details in How to create a shortcut for java webstart available for all users on Windows 7?-stack overflow
-
How to create a password for the pdf file
The Adore Acrobat XI, how to create a password for the file? Aid says going to the Tools Menu and clicking on the Protection tab - but there is no option. In the security file - properties - screen, it shows the security details but doesn't allow for no change.
I think you can be mixing two different products: (free) Adobe Reader and Acrobat ($$).
-
How to create a card for After Effects?
How to create a card for After Effects?
-
How to create the presentation for the columns variable and use it in the story?
Hi all
Someone knows how to create variable presentation for a column (that is, I need to create it in edit section formula itself). And then, I should use it in the Narrative section to display the value of this column. Is this possible? Or do I need to use any other variable for this requirement? If Yes please let me know, how to create it? This is a very urgent requirement.
Thanks in advance
StephanieHello
You can have any number of columns in the narrative view, he will accept... Just mention the numbers of the columns in the view body narrative...check if useful/correct...
Thank you
prassu -
Computation of factorial by creating a procedure for her
Hello everyone
I tried to create a procedure for the calculation of the factorail of a number
but something's not right
I hope that you guys can drive the correct path
Here is my codecreate or replace procedure factorial(n in number) is v number; begin for i in reverse n..1 loop v :=v*i; end loop; dbms_output.put_line(v); end;
Why reverse?
1 create or replace procedure factorial(n in number) 2 is 3 v number :=1; 4 begin 5 for i in 1..n 6 loop 7 v :=v * i; 8 end loop; 9 dbms_output.put_line(v); 10* end; SQL> / Procedure created. SQL> SQL> begin 2 factorial(5); 3 end; 4 / 120 PL/SQL procedure successfully completed.
-
How to create unique variables for... in loop? (AS2)
Hello
I have a function onEnterFrame controlling all the movie clips in a table. The movement of each of these clips is controlled by a few variables - speed, acceleration, etc - that are changed on every enterFrame. I can't understand how to create unique variables for each element of the array. Now my variables are the same for all elements, and therefore the proposals of each video clip are the same.
I used this code to add my video clips in the table:
for (i = 0; i < starNumber; i ++) {}
duplicateMovieClip (star, "star" + I, i);
starArray.push (this ["star" + String (i)]);
}I do a similar thing to create unique variables for each? Or is there something I need to do my loop (myClip in myArray) which is contained in my onEnterFrame function?
I can post my code if that would help (65 lines).
Creating unique variables is easy way out. Here's the modified code using unique variables that should solve your problem:
var i: Number;
var starArray:Array = [];
var starArray_X:Array = [];
var starArray_Y:Array = [];
var mc:String;
var scale: number;
var speedXMod:Number;
var speedYMod:Number;
var starNumber:Number = 10;
var minSize:Number = 15;
var maxSize:Number = 80;
var speed: number = 0.2;
var minSpeed:Number = 0;
var maxSpeed:Number = 1;
for (i = 0; i< starnumber;="">
duplicateMovieClip (star, "star" + I, i);
starArray.push (this ["star" + String (i)]);
}
(MC starArray) {}
starArray [mc] ._x = (Math.Random () * Stage.width);
starArray [mc] ._y = (Math.Random () * Stage.height);
scale = (minSize + (Math.Random () * (maxSize - minSize)));
._xscale starArray [mc] = scale;
starArray [mc] ._yscale = scale;
var startSpeedX:Number = ((Math.pow (-1, (Math.round (Math.random ())) * (minSpeed + (Math.Random () * (maxSpeed - minSpeed)));)))
var startSpeedY:Number = ((Math.pow (-1, (Math.round (Math.random ())) * (minSpeed + (Math.Random () * (maxSpeed - minSpeed)));)))
[mc] starArray_X = startSpeedX;
[mc] starArray_Y = startSpeedY;
onEnterFrame = function() {}
(MC starArray) {}
speedXMod = ((Math.random () * acceleration)-(0,5 * accélération));
speedYMod = ((Math.random () * acceleration)-(0,5 * accélération));
If (((Math.abs (starArray_X [mc] + speedXMod)) < maxspeed)="" &&="" ((math.abs(stararray_x[mc]="" +="" speedxmod))=""> minSpeed)) {}
[mc] starArray_X += speedXMod;
} else {}
[mc] starArray_X = speedXMod;
}
If (((Math.abs (starArray_Y [mc] + speedYMod)) < maxspeed)="" &&="" ((math.abs(stararray_y[mc]+="" speedymod))=""> minSpeed)) {}
[mc] starArray_Y += speedYMod;
} else {}
[mc] starArray_Y = speedYMod;
}
If (((starArray [mc]._x + starArray_X[mc]) > 0) & ((starArray [mc]._x + starArray_X[mc])))<>
starArray [mc] ._x += starArray_X [mc];
} else {}
starArray_X [mc] * = - 1;
starArray [mc] ._x += starArray_X [mc];
}
If (((starArray [mc]._y + starArray_Y[mc]) > 0) & ((starArray [mc]._y + starArray_Y[mc])))<>
starArray [mc] ._y += starArray_Y [mc];
} else {}
starArray_Y [mc] * = - 1;
starArray [mc] ._y += starArray_Y [mc];
}
}
}
}
-
Hi all
How to create a jar for icons? Please help me thanks in advance.
SarahHi Sarah!
To do this, you use at best the jdk (java development kit) which is already
installed on your pc in forms is installed.Copy all your gif icons in a folder
Open the command prompt and in this folder.If we assume that you have installed forms in the default directory, call the jar.exe like this:
x:\DevSuiteHome_1\jdk\bin\jar -cfv your_icons.jar *.gif
This will create a jar file in the same directory.
Copy the jar file into your x:\DevSuiteHome_1\forms\java folder.Then open your formsweb.cfg x:\DevSuiteHome_1\forms\server and change your configuration entry under the
archive_jini=frmall_jinit.jar
TO
archive_jini=frmall_jinit.jar, your_icons.jar
Please check if in your formsweb.cfg so the imagebase is set to the code base.
If this isn't the case, create a parameter in your config entry:imagebase=codebase
Now the jar file is loaded when you start your application and the icons are
turns red from the jar file.Concerning
-
How to create a login for PHP users
How to create a login for users to access their data, currently, I don't see the first user each time I connect with a different user name. I know that I need session stuff but don't know how to use, add or where to put them.
Thanks in advance.Hello
Find this in your login page:
session_register ("MM_Username");
and then you add a session variable in MX called it:
MM_Username
then on any of your pages that calls the base to make sure that you use the = MM_Username and then you're all set; Make sure that the tables have a field to reference the session MM_Username variable.
See you soon
Let me know if you just come! -
'create columns with a where clause' in MDB
Hi all
I have a question on the OBI EE meta data layer.
We have OBIEE sitting on a with a star schema data warehouse.
Our fact table contains the following fields...
EmployeeID
CompanyID
ID of the measure
The measure name
MEASURE
That's what we have in the physical layer, layer MDB and the presentation layer, but I want to be able to "create columns with a where clause.
So my table of facts in the presentation layer would look like this
Quantity sold
Unit cost
Amount of the company
I thought I could just create a logical with column
Quantity = measurement
where as name = "quantity".
But I can't find any to do so.
Any ideas?
Thank youHello
I think that what you want to achieve must be done in the physical layer and not the business layer.
Instead of using your physical table directly from the DB, you must create a physical table based on an SQL statement.
GO to the physical layer you / create the new object table in Table type choose "Select" and then you write your select statement as you want.
Once this is done to create your physical joins and import your table into your business layer and create your complex joins
This should do the trick.
It may be usefulConcerning
-
The use of bind variables in dynamic query created for Ref Cursor
Hello
I'm in a situation where there is a Ref cursor to which the query is built execution based on a loop. This is why the number of links would be known until the program runs.
The application is currently using literals instead of bind variables.
code snippet of the above is
strSql: = "select * from emp where 1 = 1 and ().
loop cursor1
If cond is true then
strSql = strSql | "ename = ' |" Cursor1.ColumnName;
end loop;
Open cursor2 for strSql;
How to use links in the example above.sb92075 wrote:
user13019948 wrote:
HelloHere is the code I have my trying to change literal-based link to the base.
What do you mean by "based bind?
who, what, how determines the values to be 'bound '?
He's referring to the coding style. He is currently using concatenated literal, and the goal is to change it to use the bindings.
If I understand this it is known as method 4 dynamic SQL and requires DBMS_SQL. There are examples autour but they vary according to the type of statement being generated - SELECT statements require column lists to be parsed, unlike the INSERT/UPDATE/DELETE.
This came up recently on my current project and I hit a demo. Here a table of names and values accepted procedure and had to build these in a single WHERE clause along the lines of
AND t_names(i) = t_values(i)
for an undetermined number of elements in the array. For this demonstration, I used a table that we called "attribute" (don't ask) which has columns including 'attribute_id' and 'name', and I need to build a query along the lines of
select description from attribute where attribute_id = :b1 and name = :b2
by the way '1012' and 'ISIN' respectively. (I use a table better and after a CREATE statement for her but I have to rush right now, sorry).
declare k_sql_base constant varchar2(500) := 'select description from attribute'; t_names constant varchar2_t := varchar2_t('attribute_id', 'name'); t_values constant varchar2_t := varchar2_t('1012', 'ISIN'); l_sql varchar2(500) := k_sql_base; l_rows_fetched integer := 0; l_value varchar2(4000); l_cursor_handle integer; begin -- Construct the SQL statement with column names and bind variables e.g. -- 'select description from mars.attribute where attribute_id = :b1 and name = :b2' for i in t_names.first .. t_names.last loop l_sql := l_sql || case i when t_names.first then ' where ' else ' and ' end || t_names(i) || ' = :b' || i; end loop; dbms_output.put_line('SQL statment = ' || l_sql); -- Parse the statement we built above (the remaining steps require a parsed cursor): l_cursor_handle := dbms_sql.open_cursor; dbms_sql.parse(l_cursor_handle, l_sql, dbms_sql.native); -- Associate the 1st column of output with variable l_value - required for SELECT statements: -- (actually the 3rd param here 'column' seems to be only used to get a datatype, in this case we want a string - -- dbms_sql.column_value actually extracts the value into a specified variable, which can be different. -- All examples in the documentation pass a local variable without further comment, so not entirely clear what this does other than set the output datatype.) dbms_sql.define_column(l_cursor_handle, 1, l_value, 4000); -- Now go through values array binding actual values to :bn variables in the cursor (similar to USING clause of EXECUTE IMMEDIATE) for i in t_values.first .. t_values.last loop dbms_sql.bind_variable(l_cursor_handle, ':b'||i, t_values(i)); dbms_output.put_line('Bound :b'||i || ' as ' || t_values(i)); end loop; -- Open the cursor and fetch the result (no loop here because we are expecting a single-row result): l_rows_fetched := dbms_sql.execute_and_fetch(l_cursor_handle); -- 'Returns value of the cursor element for a given position in a cursor' -- Copy the value of column 1 to variable l_value (has to match -- dbms_sql.column_value(l_cursor_handle, 1, l_value); dbms_sql.column_value(l_cursor_handle, 1, l_value); dbms_output.put_line('Result = ''' || l_value || ''''); dbms_sql.close_cursor(l_cursor_handle); end;
Hope that helps...
Maybe you are looking for
-
After upgrade to Windows 7 - printer is installed, but nothing prints
I see some posts with people who say that their printer is installed, but when they try and printing is queued for the print spooler and then disappears, or they say they can print a test page for the HP software but nothing prints. Most of these peo
-
Bluescreen system_service_exception asmtxhci.sys whenever I launch Skype
Had Skype for awhile with no problems. Updated my PC and now every time I start my computer Skype crashes with an error of system_service_exeption asmthxhci.sys. Tried uninsalling and relocation of the different versions of Skype with the same result
-
Hello I can't connect to wireless internet; However, I can via rigid cable. I was told to run a diagnostic and I received the following message: model memory 2 DIMM has failed. We advised me to go to hp.com support and download the wireless driver
-
Hello I have compaq mini 110 s/n CNU937CXRY, it can not load the system cause needs some code which I don't know. on the screen, it says "Enter CURRENT Password" After 3 trials are: Password check failed Fatal error... System stopped CNU937CXRY IF AN
-
Blue zone around drawing?
When I use the Brush tool, a boring blue box appears around that I just drew. Can I have accidentally turned on somehow and I was wondering if anyone knows how to stop it?