Why do cursors use different SQL?
Hi,
I'm havin a problem writing a cursor that returns a field when an item is found in a nested table. Well, the problem is referencing the nested table.
Where as
select f.name from objtab_fleet f,
table(f.vehicles) fv
where fv.vehicle.registration = 'G66 XYX'
works fine in SQL Plus,
When the following cursor is in a stored procedure I get the error below it!!
CURSOR qry IS
select f.name from objtab_fleet f,
table(f.vehicles) fv
where fv.vehicle.registration = 'G66 XYX'
(obviously 'G66 XYX' is passed is as a parameter)
LINE/COL ERROR
4/4 PL/SQL: SQL Statement ignored
4/13 PLS-00320: the declaration of the type of this expression is
incomplete or malformed
5/28 PLS-00201: identifier 'F.VEHICLES' must be declared
12/3 PL/SQL: SQL Statement ignored
Can anybody Help me find the right syntax?
Thanks,
Ian
for the interested the syntaxt necessary is
CURSOR qry IS
SELECT name FROM objtab_fleet f
WHERE EXISTS ( SELECT fv.vehicle.registration
FROM TABLE( f.vehicles ) fv
WHERE fv.vehicle.registration = v_in ) ;No idea why you have to do child set membership queries differently in procedures, but there you go.
Similar Messages
-
Delcare Cursor using Dynamic SQL using PL/SQL in Oracle 7.3.4
In Oracle 7.3.4, can I declare a cursor at run time using Dynamic SQL. From the sample code in this website, it seems that Oracle 8 support this function. Please help. Thanks a lot.
If I can do this on Oracle 7.3.4, could you give me some sample codes? Thanks.
Regards,
RaymondHi,
Try using the the following code where you can dynamically build the Valid Select stmt. and call that where ever you want.
declare
Type Cur_ref Is Ref Cursor;
C_ref Cur_ref;
V_Str Varchar2(100);
V_Name Varchar2(100);
Begin
V_Str := 'Select Ename from Scott.emp Where empno = 7369';
Open C_Ref for V_Str;
Fetch C_ref Into V_Name;
close C_Ref;
dbms_output.put_line(V_Name);
End;
regards
gaurav
null -
Evening all -
this is by no means the first time I'm banged my head against the colour management brick wall, and I doubt it will be the last
I am running Frame 12 and Illustrator CC on Windows 7.
Both these Adobe products ship bundled with Pantone libraries. (Correct me with I'm wrong, but these "libraries" are basically a bunch of look-up tables, mapping named Pantone colours to various CYMK, RGB, etc equivalents?)
Can anyone tell me why these two different Adobe applications appear to give different definitions for the same Pantone colours?
For example, if I choose the Pantone Coated library > 'Warm Red'
In Illustrator CC (left screenshot), it offers this as C0% M87.4% Y79.9% K0%
in FrameMaker 12 (right screenshot), I get C0% M79% Y91% K0%
Why are they different?
Are the library definitions shipped with the products simply different?
Frame's dialog ominously mentions "© Pantone, Inc., 1986, 1988"
And if I go to C:\Program Files (x86)\Adobe\AdobeFrameMaker12\fminit\color and open the corresponding .bcf file in an editor, the header says:
"BCF 2.0PANTONE¨ Coated 1.1 ©Pantone, Inc., 1986, 1988.PANTONE¨* Computer Video simulations displayed may not match PANTONE-identified solid color standards. Use current PANTONE Color Reference Manuals for accurate color. To order publications from Pantone, Inc., in the U.S. please call the toll-free number (800) 222-1149 [within NJ, call (201) 935-5500]. In other countries contact your local Pantone representative. *Pantone, Inc.'s check-standard trademark for color.[1]"
whereas if I go to C:\Program Files (x86)\Adobe\Adobe Illustrator CC\Presets\en_US\Swatches\Color Books and open the corresponding .acb swatch file in there, in amoungst the hex gibberish I note it says:
"�=$$$/colorbook/PantonePlusCoated/title=PANTONE+^R Solid Coated/$$$/colorbook/PantonePlusCoated/prefix=PANTONE *$$$/colorbook/PantonePlusCoated/postfix= CK"$$$/colorbook/PantonePlusCoated/description=Copyright^C Pantone LLC, 2010"
Have Pantone perhaps changed their colour definitions between 1988 and 2010?
(I'm thinking it would be sensible to establish this one way or the other before we get into any convoluted discussions about the Windows GDI etc etc)David,
What options did you use for defining the colours internally and what options for output in AI? I suspect that if you examine the EPS file you created from AI for the Panotne 355C, the only values in there are the CMYK ones - no LAB nor RGB. So FM has to use the algorithm mentioned in the other thread and creates the lime green based upon the algorithm. If you have set the AI drawing to an RGB color mode and set the EPS export option for "Include CMYK Postscript in RGB files" to OFF, then you would get the desired RGB values in the EPS file.
If you're so intent on using Pantone Spot colours to get RGB, then you can create your own ACF library file with the exact RGB definitions that you want (you can then use whatever values you get in Photoshop, Illustrator or whatever source that you're trying to match). The structure of the file is as follows:
ACF 1.0
My Color Library <---- name of library
LibraryVersion: 1.0
Copyright: © 2014 <your name here>. All rights reserved.
AboutMessage: User defined Spot colours for RGB
Names: Partial
Rows: 4
Columns: 4
Entries: 1 <---- number of colours in file
Prefix: <---- used for display in FM, e.g. "Panotne"
Suffix: <----- used together with prefix, e.g. "CVC, CVU, etc."
Type: Process <---- Spot, Process, Tint, Mixed (need to add specifier to Data lines)
Models: CMYK RGB
PreferredModel: RGB <---- whatever you want
Data:
0.98 0.11 1.00 0.02 <---- CMYK values (0-1)
0 38143 19967 <---- RGB values as 16-bit, i.e. 16-bit = ( [RGB value (1-255)]*256) + 255; zero is still zero
Spruce Green <---- name of colour
The acf file needs to be installed in the fminit\color folder.
Also, a note of caution, If you screw something up in the acf file (like the incorrect number of entries in the file or you're missing a component value, this will hang FM if you use the View > Color > Definitions... option. You'll need to kill FM, fix or remove the ACF file and re-start. Also, FM only reads the libraries at the start, so if you need to make any changes to the ACF definitions, you have to r-start FM for those changes to take place.
[I know, FM doesn't make it easy, but it can be done...] -
Use of SQL Profiles where each schema has very different data distribution and volumes
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Our architecture has multiple client schemas in the same database. Each schema has the same code base (tables, procedures etc) but each client's data is very different in terms of volumes and skew/distribution per table. This architecture was done based on cost - I know it's not ideal but it can't change.....
I am fairly seasoned with performance management and so know the usual tricks of when to eat up the table using parallel full table scans etc. I couldn't further optimise a given stmt for our largest table. I'll call it TSPCI and it has monthly partitions (2 years) and totals about 35Gb in the largest client schema.
Anyway, I was surprised when ADDM suggested that I could achieve 98% improvement if I were to use a given SQL Profile. Great?
So, here's my issue - I've found that the same SQL_ID is shared across all those different client schemas: I can't see how to get it to pick/use the SQL Profile in only a particular client schema - let's call it NEX - and not in another (lets call it COL).
If I generate a SQL Profile as NEX, has it analysed and built the SQL Profile based on the NEX schema and is it therefore invalid/undesirable to have that SQL Profile used in the COL schema??
I suppose that I could add a small change (say /*+ NEX */) to the SQL in the NEX schema to make the given sql unique there and then generate a SQL Profile for that..........
What am I missing here?Well, I can confirm the behaviour: accept a SQL Profile for a given SQL in one schema and verified that it is used in another schema (where the data volume and distribution is very different).
I can also confirm the workaround - simply add a hint to the SQL to make it unique such that I could use different sql profiles for the otherwise exact same sql in different schemas.
I'm happy enough with this workaround but I'll leave this thread unanswered in case someone can suggest a better approach. -
Getting core dump when using EXEC SQL CLOSE
In my pro*c program , i have used a cursor to fetch the set of accounts.Once cursor is opened , code will perform set
of operation using fetched data and then cursor is closed. Between open and closing of cursor , i have used 23 EXEC
SQL CLOSE. For example i am copying the value of a to b using strlcpy between fetch and close cursor statement.If
returned value from strlcpy is greater than size of destination variable, then flow should not proceed , in that case I will
close the cursor using EXEC SQL CLOSE and return the flow to calling program. Similarly i have closed the cursor at
another 22 locations.
When i compile the code and run binary the core dump occurs. On analyzing the core it shows
t@null (l@8) terminated by signal SEGV (no mapping at the fault address)
0xffffffffffffffff: <bad address 0xffffffffffffffff>
dbx: core file read error: address 0xfc4ffe48 not in data space
Current function is dbMtBaseClass::Pswd_Change
7860 sqlcxt(&_dbMtCtx, &sqlctx, &sqlstm, &sqlfpn);
if I remove any of the three EXEC SQL CLOSE commands , core dump does not occurs.
It looks strange.Please help me to resolve the issue.In my pro*c program , i have used a cursor to fetch the set of accounts.Once cursor is opened , code will perform set
of operation using fetched data and then cursor is closed. Between open and closing of cursor , i have used 23 EXEC
SQL CLOSE. For example i am copying the value of a to b using strlcpy between fetch and close cursor statement.If
returned value from strlcpy is greater than size of destination variable, then flow should not proceed , in that case I will
close the cursor using EXEC SQL CLOSE and return the flow to calling program. Similarly i have closed the cursor at
another 22 locations.
When i compile the code and run binary the core dump occurs. On analyzing the core it shows
t@null (l@8) terminated by signal SEGV (no mapping at the fault address)
0xffffffffffffffff: <bad address 0xffffffffffffffff>
dbx: core file read error: address 0xfc4ffe48 not in data space
Current function is dbMtBaseClass::Pswd_Change
7860 sqlcxt(&_dbMtCtx, &sqlctx, &sqlstm, &sqlfpn);
if I remove any of the three EXEC SQL CLOSE commands , core dump does not occurs.
It looks strange.Please help me to resolve the issue. -
QBE issue when using different db types
Hello,
Our ADF application has the ability to connect to the same schema but different backends (Oracle and SQL Server). I have successfully implemented switching the AM data source. I am running into a syntax issue when performing Query By Example for a table. The error is (Incorrect Syntax near "|"). In the VOImpl I overrode the function public String getViewCriteriaClause(boolean forQuery) and I can see the viewCriteriaClause is "( (UPPER(TransMasterEO.TMMessage) LIKE UPPER( ? || '%') ) )". This works when running against the Oracle instance but fails when running against the SQL Server instance.
I implemented code to replace the "||" with "+" but then we fail on Oracle. Can someone recommend an approach to resolve?
Running 11.1.1.6
Thank you
Rudyhe different dbs yre using different sql flavors. This is causing trouble if you change the connection to a db which is using a different flavor. I'm not aware that you can change the flavor used to build the queries to, but you can implement your own sqlbuilder which may just extend from the one for hte right flavor and then build the sql through the right class.
Check http://jobinesh.blogspot.com/2013/02/customizing-sql-builder-class.html for more info on how to change the sqlbuilder.
Timo -
ABT1 and ABT1N using different transactiont types
Hi,
An issue was identified whereby SAP may be computing tax depreciation incorrectly in a year in which an asset converts to straight-line and is transferred. This could potentially apply to all of the tax books in SAP. Transaction type 153 (incorrect) vs. transaction type 145 (correct) for assets that have been converted and have a "multi-level" depreciation key. Second level is incorrect.
This is because earleir they were ABT1 which was using transaction type 145. The new transaction ABT1N is using transaction type 153.
Best Regards,
Vhe different dbs yre using different sql flavors. This is causing trouble if you change the connection to a db which is using a different flavor. I'm not aware that you can change the flavor used to build the queries to, but you can implement your own sqlbuilder which may just extend from the one for hte right flavor and then build the sql through the right class.
Check http://jobinesh.blogspot.com/2013/02/customizing-sql-builder-class.html for more info on how to change the sqlbuilder.
Timo -
What is the real time use of implicit and explicit cursors in pl/sql
what is the real time use of implicit and explicit cursors in pl/sql.............please tell me
You can check the following link ->
http://www.smart-soft.co.uk/Oracle/oracle-plsql-tutorial-part5.htm
But, i've a question ->
Are you student?
Regards.
Satyaki De. -
Report using ref cursor or dynamic Sql
Hi,
I never create a report using a ref cursor or a dynamic sql. Could any one help me to solve the below issue.
I have 2 tables.
1. Student_Record
2. Student_csv_help
Student_Record the main table where the data is stored.
Student_csv_help will contain the all the column names of the Student_record.
CREATE TABLE Student_CSV_HELP
ENTRY_ID NUMBER,
RAW_NAME VARCHAR2(40 BYTE),
DESC_NAME VARCHAR2(1000 BYTE),
IN_OUTPUT_LIST VARCHAR2(1 BYTE)
SET DEFINE OFF;
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(1, 'S_ID', 'Student ID', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(2, 'S_Name', 'Student Name', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(3, 'S_Join_date', 'Joining Date', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(4, 'S_Address', 'Address', 'Y');
Insert into TOA_CSV_HELP
(ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
Values
(5, 'S_Fee', 'Tution Fee', 'N');
commit;
CREATE TABLE Student_record
S_ID NUMBER,
S_Name VARCHAR2(100 BYTE),
S_Join_date date,
S_Address VARCHAR2(360 BYTE),
S_Fee Number
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(101, 'john', TO_DATE('12/17/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94777', 2000);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(102, 'arif', TO_DATE('12/18/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94444', 3000);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(103, 'raj', TO_DATE('12/19/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94555', 2500);
Insert into Student_record
(S_ID, S_Name, S_Join_date, S_Address,S_Fee)
Values
(104, 'singh', TO_DATE('12/20/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94666', 2000);
Commit;
Now my requirement is:
I have a form with Student_record data block. When i Click on print Button on this form. It will open another window which has Student_CSV_HELP.DESC_NAME and a check box before this.
The window look like as below:
check_box DESC_NAME+
X S_ID+
-- S_Name+
X S_Join_date+
X S_Address+
-- S_Fee+
X means check box checked.+
-- means check box Unchecked.+
After i selected these check boxes i will send 2 parameters to the report server
1. a string parameter to the report server which has the value 'S_ID,S_Join_date,S_Address' (p_column_name := 'S_ID,S_Join_date,S_Address');
2. the s_id value from the student_record block (p_S_id := '101');
Now my requirement is when i click on run. I need a report like as below:
Student ID : 101+
Joining Date : 12/17/2009 08:00:00+
Address : CA-94777+
This is nothing but the ref cursor should run like as below:
Select S_id from student_record block S_id = :p_S_id;
Select S_Join_date from student_record block S_id = :p_S_id;
Select S_Address from student_record block S_id = :p_S_id;
So, according to my understanding i have to select the columns at the run time. I dont have much knowledge in creating reports using ref cursor or dynamic sql.
So please help me to solve this issue.
Thanks in advance.Plain sql should satisfy your need. Try ....
Select S_id, S_Join_date, S_Address
from student_record
where S_id = :p_S_id -
Why we use different clearing account for GR/IR and planned cost clearing a
My client ask for using same account for GR/IR account and all planned cost clearing account.
i try to convince it should be different accounts but he needs a logical answer.
Why we use different clearing account for GR/IR and planned cost clearing accounts?Dear friend.
u just tell him while doing GR it will debited n while doing IR it should get credited.hence we need to take diff G/L account or same account.
regds
nasir -
Can we use different Databases (Oracle & SQL Server) in one report?
Post Author: venki5star
CA Forum: .NET
Hi there.
Can we use different databases (Oracle & SQL Server) in a same report?
If possible how?
Another question,
Can we change the Provider Name at runtime of the given report. If so the above question is useless...
Thanks in Advance.I tried this using Oracle Provider for OLEDB (the one that supplied by Oracle Client) and Crystal Reports 9. you can drag the column into designer but the image does not appear in preview.
I guess it's because CR does not recognized it as image, and there are no information that the blob data is an image at all. -
Why can't two different users use Itunes on the same computer with different log ins
Why can't two different users use Itunes on the same computer with different log ins
Pmorgan5672 wrote:
Why can't two different users use Itunes on the same computer with different log ins
They can, but not at the same time.
If one user left iTunes running, and another user tries to use iTunes from a different Windows user ID, that second user will get an error message. If they really want to use iTunes, they either have to beg the first user to log in and close iTunes, or else they have to restart the computer.
If you are asking the technical reason why, it is something about context switching. -
How to get different field in two are more different table using open sql
Dear all,
This SenthilMani am very new into sap abap am having doubt in reports how get the different fields from different tables like mara,marc,mard using open sql and native sql program give me some tips to get the data .
with regards,
senthilHI ,
1) If u want to select data from more the two table then u can use FOR ALL ENTRIES.
EX ..Open sql
select matnr from mara into table t_mara.
select matnr werks from marc into table t_marc for all entries in t_mara where matnr = t_mara-matnr.
2) U can join more than one table.
ex:
select mara~matnr
marc~werks
from mara join marc into table t_maramarc
on maramatnr = marcmatnr
3) Using native sql ...only u can use JOIN statement -
Problem in SQL with CURSOR( ) ,Why the CURSOR did not work?
hi All:
I have a problem in SQL with CURSOR.
The data is as the attachments.
Here is the SQL statement as follow:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
IGLITM
1KV90CPG2
1KV90CPG2
1KV90CPG2
But, after I add one statement in the subquery, there is no record returned from CURSOR.
Here is the SQL statement:
SELECT A.WADCTO,A.WADOCO,B.IGCOST,CURSOR (SELECT X.IGLITM
FROM F3102 X
WHERE X.IGDOCO=A.WADOCO
AND X.IGCOST=B.IGCOST
AND X.IGCOST IN ('B1','D1','C3')) AS DETAIL
FROM F4801 A INNER JOIN F3102 B ON A.WADOCO=B.IGDOCO AND A.WADCTO=B.IGDCTO AND B.IGCOST>' '
WHERE A.WADOCO='10004'
The statement above returns records as follow:
WADC WADOCO IGCOST DETAIL
WO 10004 A1 CURSOR STATEMENT : 4
CURSOR STATEMENT : 4
no rows selected
Why the CURSOR did not work?
The database version is Oracle Database 10g Release 10.2.0.4.0 - 64bit Production.
F3102 DATA:
IGDOCO IGDCTO IGLITM IGCOST
10004 WO 1KV90CPG2 A1
10004 WO 1KV90CPG2 B1
10004 WO 1KV90CPG2 C3
10004 WO 1KV90CPG2 D1
F4801 DATA:
WADCTO WADOCO
WO 10004
Edited by: user2319139 on 2010/3/2 上午 1:17
Edited by: user2319139 on 2010/3/2 上午 1:20Why this structure and not a join?
The cursor() function returns a cursor handle that needs to be processed - in other words, the client needs to fetch data from it. The Oracle® Database SQL Reference+ (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/expressions005.htm#i1035107) describes it as being equivalent to a ref cursor handle.
Thus why are you creating ref cursor handles as a column in a SQL projection - where each row will have a "+nested+" ref cursor handle to process. What problem are you attempting to hack solve this way? -
Accessing the same database file using different handles/cursors
Will there be any problems accessing the same database file using different DB handles in a transactional environment? We have implemented a process which have multiple transient threads coming up and initiating DB opens and read/write operations to the same database file using different handles and cursors?
Can this potentially create any problems/bottlenecks? Can someone suggest the best way to deal with this scenario?
Thanks in advance.
SBHi,
Berkeley DB is well suited to the scenario you describe. You need to ensure that Berkeley DB is configured correctly for transactional access, the best information describing the requirements is in the Reference guide here:
http://download.oracle.com/docs/cd/E17076_02/html/programmer_reference/transapp.html
If there will be multiple threads operating concurrently, then you will need to design your application to detect and deal with deadlock situations.
Regards,
Alex Gorrod
Oracle Berkeley DB
Maybe you are looking for
-
At max how many columns is advisable to create in a table/view
Hi All, I have two transaction table from which i want to create a simple view or materialized view. But the number of columns is about 200. So i want to know at max how many columns is advisable from the performance point of view. Even though i will
-
Hi, I have a scenario where ABAP program triggers a ABAP proxy and passes internal table as an input. I wanted to know what's the maximum limit a proxy can accept. I have around 400K records to sent to XI using ABAP proxy and XI writes it into a file
-
Line of Best Fit/Trendline
As part of my Physics class we need to graph data that can only be displayed using a line of best fit (AKA a Trendline) - I can make any graph fine on Numbers but I am at a loss on how to make a trendline. Could you please aid me in my search to crea
-
Select Tool (blk arrow) doesn't work correctly-illustrator cs2
Hi, all. when you click on an object with black arrow, it converts to free transform automatically. so as many people might do, I used black arrow to re-size or rotate etc etc. rather than using free transform tool. but it suddenly not working. Did I
-
I have written a class, called Board. In my program, I need to create multiple instances of this class. e.g. Board1, Board2, Board3 etc. Board Board2 = new Board(); Board2 = Board1; However, when I change some parameters in Board1, the parameters in