using the SQL statement &; part P of the chain
Select * from mif where name = 'TM 9-2815-250-24 and P'.Is there a character escape to recoginize it as a literal string? I am invited to an input string. Thank you.
Use:
SET DEFINE OFF
or
The VALUE SET other_than - & - character
before you run your SQL.
SY.
Published by: Solomon Yakobson on March 2, 2011 11:51
Tags: Database
Similar Questions
-
Using a Bind Variable in the FROM of a SQL statement part?
Hi all
I have a problem, I am trying to execute a SQL statement. However, I need the FROM part of the SQL statement in a variable binding. This is because the end user will have to choose between 2 views of database.
I tried this:
Select CON_ID from: P23_DB_NAME where CON_LEGACY_ID =: P23_CONLEG_NO
I had no chance. The error I got was,
'+ The query cannot be parsed in the generator. If you believe that your request is
syntactically correct, choose the generic "columns" box below the
the source of the region without analysis.
"ORA-00903: invalid table name +".
What makes sence, but now I'm a little stuck.
Does anyone have ideas for a workaround?
Thanks in advance.
-N.S.N.O.
The example I gave you is quite simple. You must take some time to study it to see where you need to be very careful what put you where. Now, of course your example does not work becaues you have several errors. It will work for you:
DECLARE x VARCHAR2 (4000); BEGIN x := x || 'SELECT CON_ID FROM '; x := x || :p23_db_name; x := x || ' WHERE CON_LEGACY_ID = ' || :p23_conleg_no; RETURN (x); END;
Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.Opal-consulting.de/training
http://Apex.Oracle.com/pls/OTN/f?p=31517:1
------------------------------------------------------------------- -
insufficient privileges when using dynamic sql statements in the procedure
Hello
I use following script on oracle 10g. and get the error not enough privs. Please advice.
SQL > show user
The user is 'GRSADM '.
SQL > create or replace procedure grsadm.test_proc as
a varchar2 (2000);
Start
a: =' VIEW to CREATE or REPLACE
TEST_VIEW
IN SELECT
"FLAS" one
THE DOUBLE ';
immediately run one;
end;
Created procedure.
SQL > start
grsadm.test_proc;
end;
Start
grsadm.test_proc;
end;
Error on line 16
ORA-01031: insufficient privileges
ORA-06512: at "GRSADM. TEST_PROC', line 9
ORA-06512: at line 2
SQL > select * from session_privs
where the privilege as "VIEW %.
PRIVILEGE
----------------------------------------
CREATE A VIEW
REMOVE ANY VIEW
CREATE A MATERIALIZED VIEW
MODIFY A MATERIALIZED VIEW
REMOVE ANY MATERIALIZED VIEW
5 selected lines.
Published by: Rous Sharma on November 24, 2011 12:00GRSADM has a privilege ' CREATE (all) VIEW ' live?
And not via a role...SSM
Samir,
GRSADM is the owner of this procedure, it seems that the EXECUTE priv, that you suggested is already involved. -
Char invalid when you use dynamic sql statements with cursor
Hello guys,.
I'm opening a following cursor with dynamic sql
my cursor statement isv_sql := 'SELECT OS.table_name FROM OBJECT_STATS_CONTROL OS, ALL_TABLES AT WHERE OS.analyze_flag <> ''N'' AND OS.last_analyze < sysdate -1 AND AT.last_analyzed < sysdate - 1 '||v_1||';';
I get an error messageBEGIN OPEN v_cur FOR v_sql; LOOP FETCH v_cur INTO v_tabname; ......
can any body suggest me where I'm wrong0911 invalid char
Thank youRemove the semicolon at the end:
||';' -- remove this.
-
I am using the chain stabilize, but it messes up my timecode
Hello, I work for a private company invesigation, we strive to utliize Premiere Pro CS6 warp stabilize, it works fine, however, when we apply our time code presets, the timecode on the film begins to dance around the screen. I tried to use warp stablizer first, but since its smooth the camerea, timecode motion that gets loaded on the dances of images around the screen, is there a way to make time code VALID floating kind remains in the same place after the images are stabilized? Immediate help is greatly appreciated.
Try to apply the timecode to a Transparent or an adjustment instead of the video layer directly.
-
Hello. all.
I wonder how to find sql_id using a sql statement, including transport retrun and tab space multiple.
To be more precise,
My sql is:
Select
col_a,
col_b,
..
..
I usually use the following query to find the sql_id
Select sql_id in v$ sql where sql_text like 'MY SQL STATEMENT %.
When MY SQL STATEMENT includes carriage return and tab space multiple, how can I do?
Thanks in advance.
Best regards.Hello
Did you look at regular expressions? Use regexp_like instead of as.
http://www.Stanford.edu/dept/ITSS/docs/Oracle/10G/server.101/b10759/conditions018.htm
Kind regards
-
Updates using the single SQL Update statement.
Hi guys,.
I got an interview... and was not able to answer a question.
In view of the table emp... need to update the salary with the following requirement by using an SQL statement.
1 update salary + 1000 for employees who receive pay between 500 and 1000
2 update salary + 500 for employees who receive wages between 1001 and 1500
The two above the requirement should be made using only a SQL update statement... can someone tell me how to do?update emp set salary = case when salary between 500 and 1000 then salary + 1000 when salary between 1001 and 1500 then salary + 500 end;
Concerning
Arun -
Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.
CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
)
RETURNS INTEGER
AS
-Declaring variables
v_is_true INTEGER.
BEGIN
SELECT
CASE
WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)
THEN 1
ON THE OTHER
0
END
IN
v_is_true
Of
in_schema.in_tablename
;
RETURN v_is_true;
END;
/
When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist
How to use the values of the input variables on the table select statement names?
Hello
Here's a way you can use dynamic SQL statements for this task:
CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
in_first_date DATE DEFAULT SYSDATE - 1,.
in_last_date DATE by DEFAULT NULL
)
RETURNS INTEGER
AS
-IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield
-contains all the dates in the in_first_date of the range through included in_last_date
- and it returns 0 if there is no such lines.
-If in_last_date is omitted, the search only the data on in_first_date.
-If in_first_date is omitted, it defaults to yesterday.
-Time parts of the in_first_date and in_last_date are ignored.
-Declaring variables
sql_txt VARCHAR2 (1000);
v_is_true INTEGER.
BEGIN
sql_txt: = 'SELECT COUNT (*).
|| 'FROM ' | in_schema | '.' || in_tablename
|| 'WHERE ' | in_datefield | ' > =: d1'
|| «AND» | in_datefield | '< > >
|| 'AND ROWNUM = 1';
dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE"); -For debugging
Sql_txt EXECUTE IMMEDIATE
IN v_is_true
With the HELP of TRUNC (in_first_date) - d1
TRUNC (NVL (in_last_date
in_first_date
)
) + 1 -- d2
;
RETURN v_is_true;
END is_ydaydata_to_table;
/
DISPLAY ERRORS
If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above. In this way, you can easily see exactly what will be executed. Comment out the call to dbms_output under test is completed.
Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future. For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days. The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).
-
How to write the SQL without using dynamic SQL?
How can you write this under SQL without using execute immediately?
You can use static SQL (using something like a CASE statement)?
test procedure (one in varchar2, b number, each number) is
v_num_recs pls_integer;
Start
Select count (*)
in v_num
FROM table1
where
col1 = one and
If b is not null then col2 = b
If c is not null then col3 = c;
/ * i.e. If b is not null, where condition to add this line only. If c is not null, where condition should add only this line. OR condition No. it * /.
dbms_output.put_line (v_num);
end;
Or should I use dynamic SQL statements for this?
I was wondering if the two are NOT NULL? Well check this.
Select count (*) in v_num
table
where col1 = one
and col2 = (CASE WHEN (b is not null) THEN b ELSE END col2)
and col3 = (CASE WHEN (c is not null) THEN ELSE END col3 c)
-
Use the name of the db link programmatically in a PL/SQL block
Hello
I have a requirement to be able to create a database procedure that references the same db tables different names of links (i.e. a generic procedure). The procedure would be passed as parameter the name of the db link and then later in the code in the block table is queried by using the provided parameter of dblink name. I'm working on the best way to achieve this and I was wondering if anyone else has had to do the same? I'm open to suggestions here.
Here is an example of pseudo code:
procedure query_table (p_dblink_name varchar2) is
Start
Select count (*) in tableABC@p_dblink_name;
end;
/
Obviously, the code above is not correct syntax, but that's actually what I'm trying to achieve. Any ideas?
Kind regards
Leigh.You must use dynamic SQL statements
procedure query_table (p_dblink_name varchar2) is l_cnt pls_integer; begin execute immediate 'select count(*) from tableABC@' || p_dblink_name into l_cnt; end;
Justin
-
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.
-
Date range of calculation with the SQL statement
I'm sure that there is a way to do this in SQL, but I can't understand it. I can write a PL/SQL script to do it, but prefer to use a SQL statement. My database is the database of Oracle 10.2.0.4.0.
I have a table that contains information such as employee number, service id, and date effective start-up of the person in this Department. There are data in another table I want to update their department number in based on their date of entry in the range. If I could figure out how to correctly select the entry into force, I can do the rest.
I have data such as:
EMP_ID DEPT_NO EFFECTIVE
-------------- ----------------- ---------------------
101 1000 1/15 / 2001
1050 101 5/24 / 2005
101 2010 6/8/2008
101 1000 8/2/2010
I want to write a SELECT statement that returns something like this where the end_date is the eve of the ENTRY into force and the last record didn't an end_date because they are always assigned to this service. In addition, the first record in the column, I won't choose a DEPT_NO because the logic of the entry into force has been added in January 2001, he says if a person started in 1985 they might have zero departments at several times so I won't update all data for this period:
EMP_ID DEPT_NO EFFECTIVE END_DATE
--------------- ---------------- ---------------- ----------------
101 1/14 / 2001
101 1000 1/15 / 2001 5/23/2005
1050 101 5/24 / 2005 6/7/2008
101 2010 6/8/2008-8/1/2010
101 1000 8/2/2010
Here is a script to create the data into a temporary table which can be used to write a SELECT statement. I added two records of employees with different dates.
create the table temp_activity
(emp_id number (12),)
dept_no number (12).
(entry into force);
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(101,1000,to_date('1/15/2001','MM/DD/YYYY'))
/
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(101,1050,to_date('5/24/2005','MM/DD/YYYY'))
/
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(101,2010,to_date('6/8/2008','MM/DD/YYYY'))
/
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(101,1000,to_date('8/2/2010','MM/DD/YYYY'))
/
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(102,1040,to_date('1/15/2001','MM/DD/YYYY'))
/
INSERT INTO temp_activity
(EMP_ID, DEPT_NO, ENTERED INTO FORCE)
VALUES
(102,2000,to_date('6/16/2006','MM/DD/YYYY'))
/
Any help is appreciated. It's probably easy, but I can't get my brain wrapped around it.
Thanks - mikeselect emp_id, dept_no, effective, end_date from ( select emp_id, dept_no, effective, lead(effective) over(partition by emp_id order by effective) - 1 end_date, row_number() over(partition by emp_id order by effective) rn from temp_activity union all select emp_id, null dept_no, null effective, min(effective) - 1 end_date, 0 rn from temp_activity group by emp_id ) order by emp_id, rn / EMP_ID DEPT_NO EFFECTIVE END_DATE ---------- ---------- ---------- ---------- 101 01/14/2001 101 1000 01/15/2001 05/23/2005 101 1050 05/24/2005 06/07/2008 101 2010 06/08/2008 08/01/2010 101 1000 08/02/2010 102 01/14/2001 102 1040 01/15/2001 06/15/2006 102 2000 06/16/2006 8 rows selected. SQL>
SY.
-
Using the database links in a process of page plsql
I try to use a database link in a process of pl/sql page.
It works fine when I use the link name in the plsql like this:
BEGIN SELECT CARD_ID into :P12_HDR_CARD_NUMBER from [email protected];
But the name of the link will come an element of page (P12_DBLINK) filled as follows:
select db_link d, db_link r from user_db_links;
I tried the following and it doesn't work:
DECLARE l_link VARCHAR2(30); BEGIN l_link := :P12_DBLINK; SELECT CARD_ID into :P12_HDR_CARD_NUMBER from fusion.EXM_CC_COMPANY_ACCOUNTS@l_link;
It gives me:
- ORA-04052: error occurred when searching to the top of the remote object MERGER. EXM_CC_COMPANY_ACCOUNTS@L_LINK. WORLD ORA-00604: error occurred at recursive SQL level 3 ORA-02019: description of the connection to the remote database not found
I thought that perhaps the name of the link was joined with. WORLD automatically but already has the name of the link. WORLD at the end I tried stripping first but the error is the same.
Is there some synatx for what will work? Can I use dynamic sql statements?
Any suggestions are most appreciated.
Thank you
John
Hi John,.
see the following example to use the execute immediate for your purpose
SQL - Variable for the name of the database link - Stack Overflow
Let me know if that answers your query in the active thread
-
How to execute dynamically generated using GR 11, 2 SQL statements?
Hello
I would like to know if it is possible to do what the following statement which is intended :
in other words, is it possible to dynamically generate and execute a select statement in a from clause?select * from (select replace('select empno from emp', '', '') from dual);
Thank you for your help,
John
Published by: 440bx 16 July 2010 15:57 modified 'create' to 'generate' to the subjectLike many I know no. in SQL. Results of your query in the FROM clause will not be transformed as another query, but just a litral value and your outer query returns this value as "select empno from emp".
But you can use dynamic sql statements in PL/SQL using EXECUTE IMMEDIATE or DBMS_SQL.
Something like that.
DECLARE dynamic_from_clause VARCHAR2(4000) := 'select empno from emp'; vReturnVal NUMBER; BEGIN EXECUTE IMMEDIATE 'SELECT * FROM ('||dynamic_from_clause||')' into vReturnVal ; END; /
Just write memory have not tested it.
-
Puppet animator of the character using the accessories
Hello
I'm relatively new to the animation of the character æ and have been using it without too many problems. I wanted to take my puppets up a notch and include accessories to use. I'm in trouble because I have a scene in which a character is playing the guitar. The left hand meets the movable left spindle and move his own, but the law does not work; It moves just the entire torso.
I think it has something to do with how the mesh is playback of the animation puppet character or how I'm labeling layers in Photoshop (see pictures attached). I have not met a forum on this particular problem though, so if anyone has answers, I would be grateful.
Thank you
DN Ellis
Looking at the mesh & layers, CH doesn't seem to understand that his right arm is distinct from the body - note that the left is not overlap of the body (just the guitar), where is your right.
Right now, my recommendation would be to start in your PSD with your character arms away from the body (more than a pose A or T), add the draggables and sticks and then drag it from there for the animation. If you always use the chain issues, try what actually deform independent and using the stuff of style tie you're doing for the guitar.
With the upcoming 4 excerpt, I'd say make the right arm independent Warp and use the basic tool to secure it to the shoulder. So little time, you will have a much easier workflow for this.
Maybe you are looking for
-
Screen with Qosmio G30 problems?
HelloThe screen of my laptop begins to have strange colors and then goes black when I turn on the laptop, G30-148 computer. My University, IT supports diagnosed the problem as a problem of map chart/subsystem. I contact a provider authorized Toshiba,
-
10.11.2 cannot update
I'm trying to update 10.11.1 10.11.2, and I went to the App Store. No problem. I click on updates, and I have two options; Update all, or simply update to 10.11.2 (this is the only update available). Or the other option does appear a notice indicatin
-
I'm trying to upgrade my addition to the XP Home to windows Vista? As it is said above... I tried to upgrade my computer to a version of windows vista an addition to the windows XP Home. I ran out of time on the "30 day trial" of XP because my produc
-
Will HELP WRT610N - Do not get the IP address of the router?
I had trouble with my WRT610N... It of sortof in brick after attempting to upgrade linksys firmware again. Unable to access but to pings. I've held reset and plug in the unit and access management screen and download the latest linksys firmware.