Using the name of the table to Insert variable
Hello
I'm trying to use a variable as the name of table to do an insert.
The name of the table where my datas have to be inserted is EVV_ + the Ref_var of data.
My code will be more explicit:
SELECT 'EVV_ ' | Ref_Equip
IN v_Ref_Equip
OF user.c_equip
WHERE clef_equip = v_clef_equip;
INSERT INTO 'user '. || v_Ref_Equip (Clef_var, Date1, value)
VALUES (v_clef_var, 18 May 01 ', 49, 156');
I can't find the proper syntax for inclusion in. I tried a lot of syntax, but not good.
So, how can I concatenate 'user.' + my v_Ref_Equip variable?
Thanks for the help
Have a look at this immediate execution method
SQL> set serveroutput on; SQL> declare 2 v_tab_name varchar2(20) := 'temp'; 3 begin 4 execute immediate 'create table temp(id number)'; 5 execute immediate 'insert into '||v_tab_name||' values (1)'; 6 commit; 7 end; 8 / PL/SQL procedure successfully completed. SQL> select * from temp; ID ---------- 1 SQL>
Tags: Database
Similar Questions
-
Can I get the total number of records that meet the conditions of a query using the Table API?
Hello
A < row > TableIterator is returned when I ask operations using the index of tables. If I want to get the total number of records, I count one by one using the returned TableIterator < row >.
Can I get the total number of records directly meets the conditions of the query?
I can get the total number of records directly the request of the meeting of the conditions of CLI using the command Global table - name tableName - count - index index-name-field fieldName - start startValue-end endValue.
Can I get the same results using the Table API?
I used MongoDB and NoSQL Oracle for about a year. According to the experience of the use of these dbs, I think mongoDB querying interface is powerful. In the contras, the query interface is relatively simple, which results is a lot of work that is usually a long time in the client side.
Hello
Counting records in a database is a tricky thing. Any system that gives you an accurate count of the records will have a hotspot of concurrency on updates, namely the place where the counting is maintained. Such a count is a problem of performance in addition to competitive access problem. The problem is even more difficult in a system widely distributed such a NoSQL database.
The CLI has overall command that counts, but does so by brutal force - iterate keys that correspond to the parameters of the operation. This is how you must do this within the API. There is not a lot of code, but you have to write. You certainly want to use TableIterator
TableAPI.tableKeysIterator (), because a key iteration is significantly faster than the iteration of lines. Just one iteration and count. If you use TableAPI.multiGet () and a key with a touch of brightness full then, in fact, count the results as they are returned in a single piece (a list).
Kind regards
George
-
Can you attribute programmatically size when you use the table in the Cluster service cluster
I use the table of the Cluster service. The only way I know to the size of the cluster is to right click on the function and set the Cluster size. But what happens if the length of my table changes? Is there a way to make the cluster size is the number of elements in the table? Seems like labview should do this automatically at run time. There may be some nodes of property I don't know.
I tried the SQL statements, but it always boils down to having to know the number of columns is in the database prior to execution.
What I did to generate the object to be a cluster to match database fields. My recordset is an array of objects. Then I a vi member to build a recordset from the database and another Member vi to retrieve an array of clusters of the recordset object. If the database changes, I have to change the subject and these two vi. All the other Subvi call these two for the manipulation of data. No other sub - VI have bundle and ungroup functions in them, only the vi of two members. Thus a change in the database requires a change of control and two vi. Not too bad.
(I'm tooting my Horn in choosing me as accetped solution provider. I learned this bad habit of others here on the forum. )
-
The function does not properly when you use the shortcut to insert
Hello everyone. I am using first Pro CC V9.2 on a PC. I am as well as a Lynda tutorial and told me quite clearly that using the comma key insert a subclip in my sequence. However, using the shortcut brings in the full clip, not the sub. I just bring my subclip using a drag and drop, which is really slow me down. Anyone know what this could be?
When you perform your subelements, you Restrict toppings to the limits of a verified subitem?
MtD
-
Can we use the value of a variable in a warning message
I have a variable in forms6i. I want to use the value of this variable in an alert message. How is that possible?Gul says:
I have a variable in forms6i. I want to use the value of this variable in an alert message. How is that possible?Try
DECLARE err_txt VARCHAR2(200) t; al_id ALERT; al_button Number; BEGIN al_id := FIND_ALERT('My_Error_Alert'); SET_ALERT_PROPERTY(al_id, alert_message_text, 'Hello how are you mr. variable '||:variable_name ); al_button := SHOW_ALERT( al_id ); END;
Hope it works...
Hamid
-
How to find the interface using the table name target
Hi friends,
Whether it's with the help of the name of the target table, it is possible to find the name of the interface that invokes this target in ODI 11.1.1.7 table.
Thanks in advance.
Kind regards
Saro
Highlight the data in the browser store, expand its sub-tree, there is a node "filled in", under the node, it lists all the data stores that are used as sources for the current data store
then expand "used by"-> interfaces, it will display all interfaces include the current data store (but maybe the current data store is used as a source)
That's all you can get user interface, otherwise I guess you can use the SDK.
-
Hello world
We use a table control to display the log files. Each row of the table represents a log file entry. In addition to that we have put in place
Some filter chopsticks (string tonalite) to speed up filtering. This means that only the entries corresponding to these substrings are shown. So whenever the filter options
changed to renew the contents of the table.
This is done by DeleteTableRows, looking for entries to display, InsertTableRows and SetTableCellRangeVals.
It works very well.
But if we remove all the contents of the table (caused by the filter options) and then hit a button (even if the focus is on the table) you get a GPF on ProcessSystemEvents.
This occurs only after inserting a large number of rows in the table before deleting all the. For example, a table with 5000 x 2 (rowsxcolumns) reduced to 0x2.
1 create a table with 5000 x 2 (rows x columns) control elements.
2 remove all lines
3. press tab until the control panel to get the focus.
4. hit Enter for example
=> Crash
Someone has an idea? We have already 'dimmed' CTRL, but this is not enough to avoid that the focus on the table by pressing the tab key. So, which leads to an accident as well.
Thanks for the help
Philipp
Yes, it is a known issue (396240), although it is not actually on time last updated known issues. Unfortunately there is no good solution, other than just by waiting for a version corrected to be released, which should happen soon.
Luis
-
Create triggers in the table, sequence, insert and update with "model"?
It must be of rtfm, trial and error thing but you wanted to ask, is it possible to have models or similar automation for the following scenario:
1.), I add the table to the logic model
2.) Using glossary I transform a relational model that was recovered / synchronized with the data dictionary
3.) then I have the new table to add
-but
I would then have auto-DDL of to be synchronized to database:
-create sequence for the id column
-create table
-create indexes for the id column pk
-Create triggers for insert and update
-l' idea is to have db_created_dt and db_modified_dt defined in the table, so that each table has them to the fields of record etc.
-activate the triggers
Each of them following the same naming convention.
Similarity with approx. generator Apex workshop utils sql create table of the copy paste "excel" that creates 'id' - column + sequence and insert the trigger.
rgrds Paavo
Hi Paavo,
most of the steps can be made in one or other way
-create sequence for the id column
-create table
-create indexes for the id column pk
If you want to start in the logic model and you don't want to have the ID column in the logic model and select 'Create the surrogate key' checkbox in the dialog entity - you will get an identity column in the relational model and the version of database and settings in ' preferences > Data Modeler > model > physics > Oracle "you can set the sequence generation and the trigger for taking in load.
fields of record defined in the table, so that each table has them
You can add the same set of columns in all tables with the transformation script 'model of Table... ».
You can also look here Oracle SQL Developer Data Modeler 4.1 user - defined DDL generation using transformation scripts
to see how to grant your DDL generation using the transformation script. DM comes with example to generate separate tables of logging and triggers. You can create your build script of triggers that support logging in these common columns.
Philippe
-
Hi all
I am beginner in Oracle.
I have a two-column table that I use to create a view documents/statement once it meets the qualification.
The table has fields. 1 number and 2. Group. If there is more than 3 records found on this table with the same NUMBER and the GROUP he should create this table view.
Thank you
Pramod Devkate
The training is therefore two lines for a ticket and the agent. When the third row is added, create a line in the summary table. Later a fourth line is added to the table of training for this ticket and the agent, but we do not update the line in the summary table. We only touch the summary table when the third row is added to the training table, then it is only updated by the application. Very well
INSERT INTO summary (ticket, agent, total_travel, total_mtts)
Select ticket agent, sum (travel), sum (mtts)
training
where (ticket, agent) not in
(select the ticket agent summary)
Group ticket, agent
having count (*) > 2.
This inserts in the table only notes and agent ID that do not exist already.
-
by selecting the name of the table as a variable
Please correct it.
declare
v_ename varchar2 (10): = 'emp ';
Start
for j in (select ename from v_ename)
loop
dbms_output.put_line (j.ename);
end loop;
end;
get error table v_ename does not exist.
I have to use v_ename, as I don't know the name of the table.You need to use dynamic SQL statements if it is really an obligation. In the majority of cases, when people think that they need to code SQL dynamic, however, they attempt to conceal a more fundamental problem of design (often a data model that needs to be fixed). Since you haven't explained why you think you have need to use dynamic SQL statements, it is difficult to know if it's just adding more complexity to your environment.
If you know that there is always an ENAME column in which table is passed, you know that the ENAME column is always a VARCHAR2 (10), and the number of rows in the table is reasonably small
SQL> ed Wrote file afiedt.buf 1 declare 2 type ename_tbl is table of varchar2(10); 3 l_enames ename_tbl; 4 l_table_name varchar2(30) := 'EMP'; 5 begin 6 execute immediate 'select ename from ' || l_table_name 7 bulk collect into l_enames; 8 for i in 1..l_enames.count 9 loop 10 dbms_output.put_line( l_enames(i) ); 11 end loop; 12* end; 13 / SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS JAMES FORD MILLER PL/SQL procedure successfully completed.
Justin
-
You can use the table of exception when you activate a FK constraint?
Anyone know if its possible to use the exception table when you activate a FK constraint? I know that it works to allow a first key constraint, but have not been able to operate to allow a FK constraint. BTW, we use Oracle 11 GR 2.Works for me.
SQL> create table exceptions 2 (row_id UROWID 3 ,owner VARCHAR2(30) 4 ,table_name VARCHAR2(30) 5 ,constraint_name VARCHAR2(30)); Table created. SQL> create table t1 2 (col1 number not null); Table created. SQL> insert into t1 values (1); 1 row created. SQL> insert into t1 values (2); 1 row created. SQL> insert into t1 values (1); 1 row created. SQL> commit; Commit complete. SQL> alter table t1 add constraint pk_t1 primary key (col1) exceptions into exceptions; alter table t1 add constraint pk_t1 primary key (col1) exceptions into exceptions * ERROR at line 1: ORA-02437: cannot validate (RIMS.PK_T1) - primary key violated SQL> select * from exceptions; ROW_ID OWNER TABLE_NA CONSTRAINT_NAME ------------------------------ -------- -------- ------------------------------ AAB5jpAAWAAH2XTAAC RIMS T1 PK_T1 AAB5jpAAWAAH2XTAAA RIMS T1 PK_T1 SQL> delete from t1 where rowid = 'AAB5jpAAWAAH2XTAAC'; 1 row deleted. SQL> delete from exceptions; 2 rows deleted. SQL> alter table t1 add constraint pk_t1 primary key (col1) exceptions into exceptions; Table altered. SQL> select * from exceptions; no rows selected SQL> create table t2 2 (col1 number); Table created. SQL> insert into t2 values (1); 1 row created. SQL> insert into t2 values (2); 1 row created. SQL> insert into t2 values (3); 1 row created. SQL> commit; Commit complete. SQL> alter table t2 add constraint fk_t2 foreign key (col1) references t1 (col1) exceptions into exceptions; alter table t2 add constraint fk_t2 foreign key (col1) references t1 (col1) exceptions into exceptions * ERROR at line 1: ORA-02298: cannot validate (RIMS.FK_T2) - parent keys not found SQL> select * from exceptions; ROW_ID OWNER TABLE_NA CONSTRAINT_NAME ------------------------------ -------- -------- ------------------------------ AAB5jsAAWAAIP8rAAC RIMS T2 FK_T2 SQL> select * from t2 where rowid = 'AAB5jsAAWAAIP8rAAC'; COL1 ---------- 3 SQL>
-
Using the cursor to insert a value
Hello
I created a procedure mentioned below, using the slider that I want to insert a value in the table its not to insert any value. You can one to find the solution. I have compiled the procedure there is no errors...
I have a lot of value in the employee... then after table do not perform the procedures no value in employee_lkp
My structure from the Employee table is
CREATE TABLE 'VIDHYA '. "' EMPLOYEE '.
(
VARCHAR2 (15 BYTE) "PNOM."
'MINIT' VARCHAR2 (2 BYTE),
VARCHAR2 (15 BYTE) "LNAME",.
ACTIVATE THE "SSN" NUMBER (12.0) NOT NULL,
"BDATE" DATE,
'ADDRESS' VARCHAR2 (35 BYTE),
'SEX' VARCHAR2 (1 BYTE),
ACTIVATE THE "WAGES" NUMBER (7,0) NOT NULL,
NUMBER (12.0) "SUPERSSN."
ACTIVATE THE 'DNO' NUMBER (2.0) NOT NULL,
ACTIVATE THE STATISTICS STORAGE CALCULATION (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES DEFAULT TABLESPACE) 'USERS' CONSTRAINT 'PK_EMPLOYEE' KEY PRIMARY ("SSN") WITH THE HELP OF INDEX PCTFREE 10 INITRANS MAXTRANS 255 2.
CONSTRAINT 'FK_DEPARTMENT' FOREIGN KEY ('DNO') REFERENCES 'VIDHYA '. "" DEPARTMENT "("DNUMBER") ALLOW
)
employee_lkp structure is
CREATE TABLE 'VIDHYA '. "" EMPLOYEE_LKP ".
(
VARCHAR2 (250 BYTE) "PNOM."
VARCHAR2 (250 BYTE) "LNAME",.
'ID '.
)
create or replace
procedure employeelkp is
number of add_val;
i the number;
number num.
add_name cursor is select * from employee;
name_cur add_name % rowtype;
Start
Open add_name;
Select count (*) in the number of the employee;
because me in 1.num
loop
extract the add_name in name_cur;
insert into employee_lkp (id, fname, lname)
values (i,
name_cur. Lname,
name_cur.fname);
When the output add_name % notfound;
end loop;
close add_name;
end employeelkp;Try this...
Addcommit;
After
close add_name;
at the bottom.
I hope this helps...
Hamid
-
Hi all
I have a (static or dynamic) table with three lines. I need to get the number of rows in a table. I tried using instanceManager.count but it gives me 1 instead of three.
I need to use some sort of function that I can use for the other tables as well.
Can someone help me on this!
Hello
If your line names are as line1, line2, Row3 etc. If you use instanceManager.count you give 1 as we have only a single instance of Row1/2/3.
Instead, you can use the following script.
var thisElement;
var nodeLength = Table1.nodes.length; count the total length of the table node
var rowCount = 0;
for (var i = 0; i)
thisElement = Table1.nodes.item (i);
If (thisElement.className == "subform") {}
like all ranks is a subform, he travels all this and if it finds the line exists in the subform it increments the counter
If (thisElement.Name.IndexOf ("row")! = - 1) {}
rowCount ++;
}
}
}
App.Alert (number of lines);
For a dynamic line, you can use instanceManager County.
Thank you
Sidonie.
-
Authentication using the table and the existing database
Very new to APEX here. In authentication methods and was curious to know if it is possible to link the Apex on an existing Oracle database and the table to get information for user name and password. Trying to use the employe_id and last 4 of their social.
Any ideas or things I can read up to get a general idea?JosephPortello wrote:
fac586, thank you. I didn't even know what I had done.Yet one thing that happens now after I corrected my incorrect syntax.
CREATE OR REPLACE FUNCTION EmployeeIDAuth ( p_username IN VARCHAR2, p_password IN VARCHAR2 ) RETURN BOOLEAN IS form l_count NUMBER; BEGIN SELECT COUNT(*) into l_count from table@db WHERE employee_no=p_username AND bdate=p_password; IF l_count > 0 THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END;
Now returns an error of:
Error on line 15: PLS-00103: encountered the symbol "end-of-file" when expects it one of the following values:
not end up dominant static of final instantiable order pragma
manufacturer membership card
1. CREATE OR REPLACE FUNCTION EmployeeIDAuth)
2 p_username IN VARCHAR2,
3 p_password IN VARCHAR2Any other ideas?
Remove the false token form.
-
Returns the Collection using the table function
Hello
I'm trying to return a collection with registration type using the function table but face some problems.
Could someone help me with this.
Kind regardsSUNNY@11gR1> create or replace package test_pack as 2 type rec_typ is record ( 3 empname varchar2(30), 4 empage number(2), 5 empsal number(10)); 6 type nest_typ is table of rec_typ; 7 function list_emp return nest_typ; 8 end; 9 / Package created. Elapsed: 00:00:00.01 SUNNY@11gR1> create or replace package body test_pack is 2 function list_emp return nest_typ is 3 nest_var nest_typ := nest_typ(); 4 begin 5 nest_var.extend; 6 nest_var(nest_var.last).empname := 'KING'; 7 nest_var(nest_var.last).empage := 25; 8 nest_var(nest_var.last).empsal := 2500; 9 nest_var.extend; 10 nest_var(nest_var.last).empname := 'SCOTT'; 11 nest_var(nest_var.last).empage := 22; 12 nest_var(nest_var.last).empsal := 3500; 13 nest_var.extend; 14 nest_var(nest_var.last).empname := 'BLAKE'; 15 nest_var(nest_var.last).empage := 1; 16 return nest_var; 17 end; 18 end; 19 / Package body created. Elapsed: 00:00:00.01 SUNNY@11gR1> select * from table(test_pack.list_emp); select * from table(test_pack.list_emp) * ERROR at line 1: ORA-00902: invalid datatype Elapsed: 00:00:00.01 SUNNY@11gR1>
SunnyHello
I had to look, because I didn't know the difference. If you use a function in the pipeline, then Oracle will create the implicit type. Take a look at the types:
select object_name from user_objects where object_type ='TYPE';
There are now objects that you create yourself, having PLSQL in name.
If you try your first example, you will see it will be no object created by implicit Oracle, so you must declare yourself in SQL.
Herald tiomela
Superconsult.nl
Maybe you are looking for
-
How to add songs to itunes and listen to these songs
I'm adding pieces via itunes but not found in the iphone and thus unable to listen to songs. How to solve the problem.
-
Equium L20-264: CD/DVD player can read but not burn discs
Hi all I need help. My laptop cd/dvd driver does not recognize the discs inside. It only happens when I try to burn a disc. She can read but not burn the discs. What could be the solution? I tried different brands, the last time it was Maxell. The ma
-
Equium A60 - 173: A the wireless card or not?
I wana to know either my laptop (EA60-173)has the wireless card or not. If so then I can set it up
-
Game Top Spin 2 ERROR 1402 could not open key
I try to install the game Top Spin 2, but I have the problem with the Error 1402.Could not open key: UNKNOWN/components and more numbers. Any solution for Windows XP?
-
FbsSearchProviderIE8 application has stopped working
I have Vista Home Basic and just recently have this pop up on my computer when I turn it on. I have read some information on the forum, but it looks like the solutions is causing so many problems. I need to know how it fly away or cause damage in s