by using the parameter entry is as column names
Hi allI have a stored proc in which I get the column names as parameter with string delimited by commas. For example, if I get
Address, city, name, zip_code as a varchar2 in my stored proc is the name of the parameter
p_param
I can do
Select p_param from
VW_Personal
or is their any simple way, I can use these list of parameters by commas as the column names in my stored proc.
Any help will be appreciated.
Thank you
I copy - paste the same answer I gave to another question this morning:
You can use ref Cursor, anyway when you retrieve the values you need to know the number and the type of data in the columns.
SQL> create or replace procedure print_enames(in_col in varchar, in_val in varchar2) is
2 c sys_refcursor;
3 v_name emp.ename%type;
4 begin
5 open c for 'select ename from emp where '||DBMS_ASSERT.SIMPLE_SQL_NAME(in_col)||'= :1 ' using in_val;
6 loop
7 fetch c into v_name;
8 exit when c%notfound;
9 dbms_output.put_line('ename='||v_name);
10 end loop;
11 end;
12 /
Procedure created.
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> set serverout on
SQL> exec print_enames('mgr','7839')
ename=JONES
ename=BLAKE
ename=CLARK
PL/SQL procedure successfully completed.
SQL> exec print_enames('sal','1250')
ename=WARD
ename=MARTIN
PL/SQL procedure successfully completed.
SQL> exec print_enames('deptno','30')
ename=ALLEN
ename=WARD
ename=MARTIN
ename=BLAKE
ename=TURNER
ename=JAMES
PL/SQL procedure successfully completed.
Max
Published by: Massimo Ruocchio, June 23, 2011 17:02
As well stressed Centinul this approach is prone to sql injection.
Usage of DBMS_ASSERT function. SIMPLE_SQL_NAME can avoid this problem, but there are onliy on Oracle 10.2 and later.
Tags: Database
Similar Questions
-
By using the parameter as a column in a select statement inside the stored procedure.
I'm doing a variation of what follows. Can someone tell me how to use the parameter passed in the IN clause correctly? Thank you
Deleted table.drop table test1; drop table test2; CREATE TABLE TEST1 ( COL1 NUMBER ); CREATE TABLE TEST2 ( COL2 NUMBER ); insert into test1 values (1); insert into test2 values (1); commit; create or replace procedure test_sp (col_name varchar2) as var1 number; begin select col1 into var1 from test1 where col1 in (select col_name from test2); end; exec test_sp ('COL2');
Deleted table.
Table created.
Table created.
1 line of creation.
1 line of creation.
Validation complete.
Created procedure.
BEGIN test_sp ("COL2"); END;
Error on line 29
ORA-01722: invalid number
ORA-06512: on-site ".» TEST_SP', line 7
ORA-06512: at line 1You must use dynamic sql statements:
SQL> drop table test1; Table dropped. SQL> drop table test2; Table dropped. SQL> CREATE TABLE TEST1 2 ( 3 COL1 NUMBER 4 ); Table created. SQL> CREATE TABLE TEST2 2 ( 3 COL2 NUMBER 4 ); Table created. SQL> insert into test1 values (1); 1 row created. SQL> insert into test2 values (1); 1 row created. SQL> commit; Commit complete. SQL> create or replace procedure test_sp (col_name varchar2) 2 as 3 var1 number; 4 begin 5 execute immediate 'select col1 from test1 where col1 in (select ' || col_name || ' from test2)' into var1; 6 end; 7 / Procedure created. SQL> exec test_sp ('COL2'); PL/SQL procedure successfully completed. SQL>
SY.
-
prompts the user for input, but use the last entry as departure
Hello, I am currently having a VI that I invited the user to a text and then input I use this input text thereafter. However, I would like to have the guest so that I can use the last entry of the bite as a starting point. Started the code, I do not know how to proceed. Any help will be greatly appreciated.
Thank you.
hiNi
If you add a record to offset uninitiallized and change the express vi, you can do it.
-
How to use the parameter B-BIS in a factory of connections
How to use the parameter B-BIS in a factory of connections (OS 5.0)?
I have found no no API for it.
-
I am trying to decide whether to use the parameter Raster or vector in the States of the object when the majority of the screen is a picture (with a modest but important legend for children to read). The legend certainly makes it look more net as vector. But does the photo! The raster setting seems to make the lower-res images in comparison. In my first edition of my application, I thought that raster would be the best setting when the photo was the subject dominating the page. But now, after seeing how strong he looks like vector, (but with almost a refresh of the unacceptable time. Perhaps better on the latest iPad. Most of my readers/students in class will use iPad 2 s, which has a slower processor). I wonder if I should go through the trouble of changing States of photo objects that have the type as well to the vector. It doesn't seem to be as sensitive to a re - draw on the iPad 2 (non-retine)
Is Filesize hit if I make about 1200 on these objects range from Raster to vector? (It is a huge, highly interactive history book, so I'm curious if acutally go to vector on these photos would reduce the size of the file) What is the best setting for the overall performance?
I see the freeks screen outside for a bit if you try to pinch and zoom in a vector object (photo) vs raster. Which is disappointing. Does slow down load time/refreshment in frame, which is a little less. I also found that the drop shadows really bad that redraws effect in vector, almost vibrating in a slide show, for example. Thus, in cases where I need shadows, I'm sticking with Raster.
All tips go ahead?
Brian
Does that help? http://boblevine.us/Digital-Publishing-Suite-101-keep-text-sharp-in-raster-slideshows/
-
Update a record questioned using the parameter
Hi all
Have someone to help me to update an interviewed record of forms. It's like that when I use ID to search for the details, I want to update the record you are searching.
ArifHi Arif,
Here you're doing something complicated with you.1 UCID_PARAM and USERCREATION are 2 revenge in the same form
2 UCID_PARAM contain column UCID which is the primary key of the table usercreation. I used this block to passThe blockk UCID_PARAM here is the database block and why you must pass the value as a parameter because as you say it is primary key and foreign key in the block. Then why do you use search mechanism Assembly. I mean just create relationship between UCID_PARAM and USERCREATION block or if he joins then just use the method ENTER_QUERY and EXECUTE_QUERY. I understand because if you enter a value in the UCID_PARAM block and goes to the block of detail and do EXECUTE_QUERY by selecting a WHERE CLAUSE.
So, what's going to happen here. System takes into account that you are inserting record in UCID_PARAM. So, there is a field that is not null, then the error is coming.
Just use the default behavior of your forms. Or if you really want to use this method. Next, create a block of data non-base to pass the parameter. Do not use UCID_PARAM as the database block.
And one more thing, I noticed in your this clause
set_block_property ('USERCREATION', onetime_where, 'UCID =' |) ': UCID_PARAM. UCID');
It should be
set_block_property('USERCREATION',onetime_where,'UCID='||:FORM_FIELD_NAME);
I hope it is clear now.
-Clément
-
Using the Evaluate function as source columns in presentation services.
Can we use Evaluate function to get values from a data source (Oracle DB in my case) and to act as a column.
I have custom DB function in oracle DB, it takes the input string parameter and returns a string. I am directly call this Evaluate function in the formula of change for any column in my sector of activity:
EVALUATE ('FUNC_NAME (%1)', 'ABC')
It gives following error.
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 14027] The browser cannot process the following query containing only constants: evaluate (FUNC_NAME (%1), 'ABC') as c1. (HY000)
Publ. SQL: SELECT EVALUATE ('FUNC_NAME (%1)', 'ABC') saw_0 OF XXX ORDER BY saw_0
Can use us the function Evaluate directly call and receive the value of the underlying database? We need to have a column from presentation services? Is there another way to do this?Regardless of the generation EVALUATE expression (using the constant only) in the DPR MDB logical column or simply in the responses there are a few rules:
1. the RPD and answers
If you want to query just EVALUATE expression without another column, then it must do (example):Column1:
CASES where 1 = 2 then. Another EVALUATE PROD_CATEGORY ('TO_CHAR (%1)' as char, 100) endEvaluate uses only constant. We place the presentation inside the case attribute to make the browser to handle this request.
2 responses
You can only use EVALUATE ('TO_CHAR (%1)' as char, 100) in the expression column of answers but only in combination with another attribute of presentation, is not only EVALUATE ('TO_CHAR (%1)' as char, 100) in the query.Column1: PRODUCTS. PROD_CATEGORY
Column2: EVALUATE ('TO_CHAR (%1)' as char, 100)Concerning
Goran
http://108obiee.blogspot.com -
Using the parameter nls_length_semantics
What is the use of nls_length_semantics pratamter?
And what is the difference if the parameter nls_length_semantics = 'CHAR' rather than 'BYTE '.
Thanks in advanceNLS_LENGTH_SEMANTICS allows you to create CHAR and VARCHAR2 columns by using the semantics of length in bytes or characters. The existing columns are not affected.
NCHAR, NVARCHAR2, CLOB, and NCLOB columns are always based on characters. You may need to you use the semantics of bytes in order to maintain compatibility with existing applications.
NLS_LENGTH_SEMANTICS does not apply to tables in the SYS and SYSTEM. The data dictionary always use byte semantics.
http://www.oratransplant.nl/2005/11/
-
Additional column names selected when you use the describe "popup" to select columns
Hello
In SQL Developer 3.2.20.09, if you use the popup describe the function on a individual table columns using Ctrl + click (not shift click choosing a range of columns) and select and then drag them to the SQL worksheet to find the column names, it includes all of the columns between the individual columns that have been selected.
For example if I choose column 1 and 5, it includes 1,2,3,4,5 columns when I drag them through.
Simple to reproduce on any table, just open the SQL worksheet, type the name of a table, open the popup describe and select some columns.
Kind regards
Steve
Is not past in v4 ai2 it seems to be fixed.
-
How to use the default value of a column in a table in insert or upda
Hello
I try to use the values by default so that the user should not have to enter data, but when I select default type and a default, I see an error message if I try to add a new line.
How can I use a default value to a column in a tabular presentation?
Gouri
Published by: user1046395 on April 3, 2009 09:58Gouri,
You can change simply to attribute each report column. For example,.
To set the default date.
Default type: PL/SQL Expression of function
Default: sysdateTo set the default text,
Default type: PL/SQL Expression of function
Default: * "CLERK."If you still get an error, what is the error message?
Tarraf -
problem when you use the parameter $ v in a package
Hello.
I have to get the parameter data $ v view within a packet, but when I compile it, he gives me the error "PL/SQL: ORA-00942: table or view does not exist. However, the owner of the schema of the pacckage has privileges during this point of view because when I run select * v parameter $ outside of the package, I get data without problem.
I tried to compile using the names SYS.v$ parameter and SYS.v$ _parameter, but none of them works.
Do I need special privileges to sys or something like that? What is the command?
I also tried this:
create or replace view oracle_parameter
as
Select *.
setting of v$.
but it showed me the error "Insuficient privileges."
Thank you.The user needs to have the privilege granted explicitly not through roles.
Trygrant select on v_$parameter to user1;
also
create or replace view oracle_parameter
as
Select *.
setting of v$.but it showed me the error "Insuficient privileges."
What is the number of the ORA error? Make sure that the user has create the privilege of seeing as well.
Published by: yingkuan on January 20, 2009 15:41
-
How to use the transformation script to add columns to the PK?
I'm working on a script transformation that:
-create a table
-Adds the columns to the table
-create a primary key for the tableSee the below script.
Now, I want to add the primary key column.
Documentation fix r: class IndexColumnUsageThe Index of the class has a getter: getIndexColumnUsageList()
and the list apply: applyIndexColumnUsageListSomeone at - it an idea how to use these methods to add the column to the PK?
I thank in advance.
relational = model.getDesign () .getFirstOpenRelationalDesign ();
table = relational.getTableSet () .createTable (null);
table.setName ("TABLE");
column = table.createColumn (null);
column.setName ("COLUMN");
index = table.createIndex (null);
index.setName ("PK");
index.setIndexState ("primary obligation");Hello
If you have the column and index (both belonging to the same table) use:
the index. Add (Column);
to remove the column:
the index. Remove (Column)
Philippe
-
using the text entry box or text are button
Hello
How do these?
using text or text box widget box.
to describe:
in my first slide I text entry areas for
1 user name
2. name of the superior
3. the e-mail of the superior court
Let's say that: 1. refer to varialbe V_UserN
2. refer to V_sup
3 see V_emailS
next slide would be a video
next slide would be a text entry or a text box... It is where the user writes anything
With the button "submit" text entry box
What I want in this text entry box is... If the user does not write any what upone by clicking on the button submit, the interaction would be 'please write a review on the text box. If the user write something the thing, the Send button run continue.
How can I do this?
next slide would be an input text field or a text box... in which the user write something on the issue (this isn't a slide of questionnaire). The message would be sent to the email of superiors. How can I do this?
hope you can help me.
Thank you
To check if the user didn't write anything, you will have to compare the value of the associated variable of the TEB or text box with a v_null user variable. You must create this user variable and simply leave it blank.
Take a look at my blog:
You create the custom with standard objects question slide. There is a widget mail included with Captivate, but did not try if you can insert the value of a variable by an email address.
Lilybiri
-
Using the parameter EFFECTIVE_DATE in PAY_ELEMENT_ENTRY_API
I call the UPDATE_ELEMENT_ENTRY procedure in the PAY_ELEMENT_ENTRY_API. Comments in the API to say some EFFECTIVE_DATE that it "determines when the DateTrack operation will be implemented." Can someone tell me what this means? I know what DateTracking is (of course!) but how does the EFFECTIVE_DATE apply?
I'm changing the default associated with the item, and I thought that EFFECTIVE_DATE would control when the changed amount comes into force; However, the updated amount appears before and after the date on which I used in EFFECTIVE_DATE.When you call the update API, you will also pass the Date range Mode.
If track Mode Date = '' CORRECTION '' then, recording is active, as of the entry into force will be updated.
If trace Mode Date = "UPDATE", then a new balance sheet Date would be established from the date of entry into force.
If trace Mode Date = "UPDATE_CHANGE_INSERT", then a new track record Date would be established with the entry into force = early entry into force and effective Date = Date of the effective start of the future record - 1.
If trace Mode Date = "UPDATE_OVERRIDE", then all future records of entry into force will be deleted and would create a new track from the Date of entry into force.
I hope that this would help you understand the importance of membership as well as modes of track Date.
Kind regards
Sharath -
Remote function call of dblink in a procedure by using the parameter as dblink
Hello.
Need to call a function of distance of a procedure with a parameter like dblink. Is this possible?
EX:
DECLARE
remote_db varchar2 (10);
exec_string varchar2 (100);
result varchar2 (10);
BEGIN
remote_db: = myremotedb;
exec_string: = ' miremotefunction@'|| exec_string | "in the result of the double."
run immediately (exec_string);
END;
Any other sugestion?
Thank you very muchAny other sugestion?
Yes, hide all remote objects behind local synonyms. Then you need dynamic SQL and avoid all the headaches.
In the case of link names change in environments, and deployment, simply a new set of synonyms for each environment.
Concerning
Peter
Maybe you are looking for
-
Contact ID for the iphone 6 no longer works after that I added my fingerprint to my new iPhone 6 s
Greeting I also have this problem with my iphone 6. After I added my fingerprints on iphone 6s, he stopped work on the 6 and a message appears saying: 'Failure cannot complete installation Touch ID please go back and try again' and now my question is
-
How to start for the following format to Irradiance?
http://www.solar-repository.SG/index.php/meteorological-data/live-data.html If I want to the table as the Global irradiance. How can I start?
-
Microsoft Outlook 2003.
I can't open it. I do not have the disk and I have 2007 is installed. But all my addresses are in version 2003 I can't open. How can I access the addresses?
-
Hello, I am desperate to find a solution... I have a new HP6604f, windows 7 (64-bit) Home Premium, full office 2010 pro. It seemed to work Ok when pulled up and after all updates have been made employment insurance policies are tiny, most of them are
-
Signature of the problem Additional information about the problem Bucket ID: 957920082 Problem event name: CLR20r3 Signature of the problem 01: gfxui.exe Signature of the problem 02: 8.15.10.2021 Signature of the problem 03: 4b26ebe7 Signature of the