Initialize the record with constants type
Hi all
I need to initialize the record type that has 3 fields with constants.
Please find the code example:
DECLARE
P_rec RECORD TYPE IS
(
ID1 VARCHAR2 (50).
CLID VARCHAR2 (50).
P_ID VARCHAR2 (50)
);
TYPE p_rec_tab IS TABLE OF THE p_rec;
v_p_rec_tab p_rec_tab
: = p_rec_tab ((«PA1», '1', «A»),)
('PA2', '2', 'B').
('PA3', ' 3 ", 'C').
(WOULD BE "PA4', ' 4 ','),
('PA5', '5', 'E')) ;
number of v_count;
BEGIN
v_count: = 0;
BECAUSE me IN v_p_rec_tab. FIRST...
v_p_rec_tab. LAST
LOOP
v_count: = v_count + 1;
dbms_output.put_line (' a record number: ' | v_count);
Dbms_output.put_line (' v_p_rec_tab.id1:' | v_p_rec_tab.id1 (i));
Dbms_output.put_line (' v_p_rec_tab.clid:' | v_p_rec_tab.clid (i));
Dbms_output.put_line (' v_p_rec_tab.p_id:' | v_p_rec_tab.p_id (i));
END LOOP;
END;
Exception, I get:
ORA-06550: line 12, column 24:
PLS-00306: wrong number or types of arguments in the call to 'P_REC_TAB '.
ORA-06550: line 11, column 18:
PL/SQL: Ignored Element
ORA-06550: line 22, column 13:
PLS-00320: the declaration of the type of the expression is incomplete or incorrect
ORA-06550: line 22, column 4:
PL/SQL: Statement ignored
Try the below
SET SERVEROUTPUT ON
DECLARE
P_rec RECORD TYPE IS
(
ID1 VARCHAR2 (50).
CLID VARCHAR2 (50).
P_ID VARCHAR2 (50)
);
TYPE p_rec_tab IS TABLE OF THE p_rec;
v_p_rec_tab p_rec_tab;
number of v_count;
BEGIN
v_count: = 0;
SELECT * COLLECT in BULK IN the v_p_rec_tab OF
(SELECT 'PA1', ' 1', 'A' FROM dual UNION ALL)
SELECT 'PA2', '2', 'B' FROM dual UNION ALL
SELECT 'PA3', '3', 'C' FROM dual UNION ALL
SELECT 'PA4', '4', would be "OF double UNION ALL
SELECT 'PA5', '5', 'E' OF THE double);
BECAUSE me IN v_p_rec_tab. FIRST... v_p_rec_tab. LAST
LOOP
v_count: = v_count + 1;
dbms_output.put_line (' a record number: ' | v_count);
Dbms_output.put_line (' v_p_rec_tab.id1:' | v_p_rec_tab (i) .id1);
Dbms_output.put_line (' v_p_rec_tab.clid:' | v_p_rec_tab (i) .clid);
Dbms_output.put_line (' v_p_rec_tab.p_id:' | v_p_rec_tab (i) .p_id);
END LOOP;
END;
----- OR --------
SET SERVEROUTPUT ON
DECLARE
P_rec RECORD TYPE IS
(
ID1 VARCHAR2 (50).
CLID VARCHAR2 (50).
P_ID VARCHAR2 (50)
);
TYPE p_rec_tab IS TABLE OF THE p_rec;
v_p_rec_tab p_rec_tab: = p_rec_tab();
number of v_count;
BEGIN
v_count: = 0;
v_p_rec_tab. EXTEND (5);
v_p_rec_tab (1) .id1: = 'PA1 ';
v_p_rec_tab (1) .clid: = '1';
v_p_rec_tab (1) .p_id: = 'A ';
v_p_rec_tab (2) .id1: = 'PA2;
v_p_rec_tab (2) .clid: = '2';
v_p_rec_tab (2) .p_id: = 'B ';.
v_p_rec_tab (3) .id1: = 'PA3 ';
v_p_rec_tab (3) .clid: = '3';
v_p_rec_tab (3) .p_id: = 'C ';
v_p_rec_tab (4) .id1: = 'PA4.
v_p_rec_tab (4) .clid: = '4';
v_p_rec_tab (4) .p_id: = ';
v_p_rec_tab (5) .id1: = 'PA5.
v_p_rec_tab (5) .clid: = '5';
v_p_rec_tab (5) .p_id: = 'E ';
BECAUSE me IN v_p_rec_tab. FIRST... v_p_rec_tab. LAST
LOOP
v_count: = v_count + 1;
dbms_output.put_line (' a record number: ' | v_count);
Dbms_output.put_line (' v_p_rec_tab.id1:' | v_p_rec_tab (i) .id1);
Dbms_output.put_line (' v_p_rec_tab.clid:' | v_p_rec_tab (i) .clid);
Dbms_output.put_line (' v_p_rec_tab.p_id:' | v_p_rec_tab (i) .p_id);
END LOOP;
END;
Tags: Database
Similar Questions
-
Initialize the cluster with data types different (lots of data)
Hello
I have data, which are composed of different data types. First of all, I have initialize cluster with these types of data and then "print" to light (photo). In case of photo data carries 8 characters than ja 4 floats. It was easy to initialize, but here's the question: How can I do this even if I have data that look like this (interpreter):
floating point number
name char [32]
Short value [16]
What I create loooong cluster which have a fleet of 32 characters, 16 short films? Or I can create these 'paintings' in a different way?
THX once again
-Aa-
I suggest using the table-cluster and configuration of the cluster size to match the size of your berries, then package these groups together. In terms of storage of LabVIEW, there is no difference between a group of
floating point number
Name1 tank
name2 tank
...
short value1
short value2
...
and a bunch of
floating point number
-> cluster shipped from
Name1 tank
name2 tank
...
-> cluster shipped from
short value1
short value2
So you can use the cluster table to get the right sizes rather than individually create all these values in a single giant cluster.
-
How to initialize the recorder?
Hello
How initialize the recorder in jsp ?
I tried:
static Logger logger = Logger.getLogger ("XELLERATE");
Logger.Warn ("example text");
.. but it throws error:
Recorder cannot be resolved to a type Logger...
Is another way to do this?
Kind regards
N....
Published by: m.m. December 2, 2009 03:54Add these lines:
<%@ page import="com.thortech.util.logging.Logger" %>
< %="">< br="">Logger logger = Logger.getLogger ("XELLERATE"); < br=""> logger.warn ("* text sample *"); < br=""> %>
-
I get videos from cell phones of the people with a type of file like 3GP. I need to know how to save and change the format so I can open them.
Trying to convert to the. WMV format:
There are many converters available on the net... some
free... some detail.The following freeware converter is just one example:
(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)Format Factory (freeware)
http://www.videohelp.com/tools/Format_Factory
(the 'direct link' is faster download)
(the file you want to download is: > FFSetup295.zip<>
(FWIW... installation..., you can uncheck
('all' boxes on the final screens)
(Windows XP / Vista / 7)First, you will need to decompress the file or just open the
Drag > FFSetup295.exe< out="" of="" the="">
and drop it on your desktop. To install left click.Next, after the download and installation of Format
Factory... you can open the program and
left click on the toolbar, the "Option" button and
"Select an output folder to" / apply / OK.
(this is where you find your files after they)
are converted)Drag and drop your video clips on the main screen...
Select "all to WMV" / OK...
Click on... Beginning... in the toolbar...
That should do it...
Good luck...
-
Throw the records with null values columns
Hi all.
Anyone know how to dispose of records containing null column values?
In the target table, I have the set Null option? with "N"... then the process sqlldr load some records. I need to load all of this without the records with null column values. by result, if the field X is null then load the file.
Kind regards.
Published by: ASzo on 05/06/2013 12:37
Published by: ASzo on 05/06/2013 12:38
Published by: ASzo on 05/06/2013 12:42load data
INFILE...
in the table...
When x! = ''
fields completed by...
(x ...) -
How to change the name of the attribute with ALTER TYPE?
I have a question. How can I change the name of the attribute with ALTER TYPE? example:
CHANGE the type of ATTRIBUTE to CHANGE type_attribute...
What should I put in «...» "to change the attribute name?
Thank you...What should I put in «...» "to change the attribute name?
You can not. You can change the data type.
You can delete and recreate the attribute:
ALTER TYPE type DROP ATTRIBUTE type_attribute; ALTER TYPE type ADD ATTRIBUTE new_type_attribute data_type;
Max
-
Initialize the dashboard with no result
Hi all
I have a number of dashboards if left to run without parameter will return too much data and look a bit funny overall that users will almost never run the report with absolutely no filtering/guests.
I remember reading a blogpost somewhere (but I can't find it now) that a detailed method to initialize with no data, the returned dashboard until the user, press the button 'Go' for the first time. Anyone know an approach similar to this or have a link to a place that I can reference?
Thank you
K(1) have a default value for the command prompt which has no chance to be in your report.
This will produce a report of any record. From here you have two options for your dashboard.
First option:
(2) use NAV. guided tour of the section in which your report is located and navigate to the report to see if it returns the lines.
(3) add a text object in a separate section just below the one above. Use the Navigation guided on this section to display the section if the report returns NO rows.
(4) in the text window, type the following. Make sure that you select the HTML check box.
Please enter something in the prompt
Second option:
(2) set up the display of "No. Results" of your report and when no record is found, the message is displayed.
-
by comparing the records with another table
Hello
I have the following 2 tables (test_prs & test_dep) and registers
My goal is to compare test_prs with test_dep records and return the records that are not in test_dep
Here is the table scripts
I tried the following query to meet my criteria. My output should be null, but all recordscreate table test_prs (id ,p_id ,r_id) as select 1,200566,200566 from dual union all select 2,200567,200567 from dual create table test_dep (id,de_typ,de_id,de_u_typ,de_u_id) as select 10,'AS',200566,'PG',200566 FROM DUAL UNION ALL select 11,'AS',200567,'PG',200567 FROM DUAL insert into test_dep select 12,'AS',400189,'PG',400273 FROM dual union all select 13,'AS',400273,'PG',400250 FROM dual union all select 14,'AS',400273,'PG',400192 FROM dual union all select 15,'AS',400273,'PG',400191 FROM dual insert into test_prs select 3,400273,400273 from dual
Could you please help me the sameselect * from test_prs prs where exists (select 1 from test_dep de where de.de_id !=prs.p_id and de.de_u_id !=prs.p_id )
Published by: smile on 7 March 2012 15:00Smile says:
Thanks for the requestThe query does not work with the following documents
insert into test_dep select 16,'AS',750664,'PG',750758 FROM dual insert into test_prs select 4,750758,750668 from dual
the r_id should not be put in correspondence with the columns in the test_dep table. P_id must only be put in correspondence
OK, you want to match against the de_id and the de_u_id p_id? Or a line where either p_id concordances r_id de_u_id or de_id must not be returned?
To match p_id against de_id and de_u_id, you can write the query like this:
select id, p_id, r_id from test_prs where p_id in (select p_id from test_prs minus select de_id from test_dep minus select de_u_id from test_dep);
Brgds
Johan -
Return only the records with a string of text that is less than a certain value?
Hi people,
I'm not sure whether this is possible or not, but worth-
I need to be able somehow output only the lines with the text of a column field less to (because of the arguments) 30 characters (including spaces). I know that I can use CFs Left() function to cut the chain, but I don't want to have words cut off mid-sentence. Therefore, I want to somehow restrict the query to only the records that contain a string of less than 30 characters.
Is this possible?
Thanks in advance :-)You can use the length of the db function. It may or may not be named LEN()
SELECT SomeColumn
FROM YourTable
WHERE LEN (SomeColumn)<=>=>Or you can retrieve all of the records and use one of the functions of the chain at cflib.org as FullLeft().
http://www.cflib.org/UDF.cfm?id=329 -
Insert the record with the decimal string?
I want to insert a record with commas, as the below:
Is there a way we can insert commas in the table?INSERT INTO TABLEA(CITY) VALUES('ALBANY,NEWYORK,TROY')
This statement has been inserted
What is your question.
SQL> INSERT INTO TABLEA(CITY) VALUES('ALBANY,NEWYORK,TROY') ; 1 row created.
-
How to get the record with a tank of extra space
Hi I have a value which have several entries with the same value but some record have more space, how to know which record
Ex:
'abc1234 '.
'abc1234 '.
'abc1234 '.
I want to know 'abc1234' record
in this table, I have more than 50 million records.
Maybe this:
SELECT s FROM T WHERE s LIKE '% '.
-
I made new files so I could have a better time line, but the Organizer will not let me load them. The new files contain the same images, but they are better organized. To add pictures in the folders I have to delete those in the organizer and start again? I feel like I got this backward little and should have organized their first. Help.
virginiae56248392 wrote:
I made new files so I could have a better time line, but the Organizer will not let me load them. The new files contain the same images, but they are better organized. To add pictures in the folders I have to delete those in the organizer and start again? I feel like I got this backward little and should have organized their first. Help.
The key to understanding the difference between the Organization of your files and folders directly in your disk folders tree and by organizing with a catalogue, is that the catalogue:
-contains no image files, that links to the actual location on the disk
-stores the links in a database with organizers strict rules, which is to avoid duplicates.
One of the highlights of the databases such as those in the elements or Lightroom is that they store duplicate data. Which avoids not only of space useless, but also ensures that you're updating a file and forget its duplicates. As a result, the Organizer will prevent you from 'import', which is to 'index' your files several times. It recognizes the files into two criteria: the size of the file in kilobytes and the "date" of the shooting.
The other strength of the catalogue, it's that you can select the sort order of your files displayed: by date, name of the file, import annealing in Bell or same "custom" order in albums. This means you don't ever need to have your physical files and folders sorted by dates on your drive. Try to get a similar organisation to the date on your car in your catalog can be an unnecessary pain. Good if you choose a folder structure to date in office at the time of importation; There must be little order at this time anyway. Once your photos are cataloged, the rule is that if you want to change the structure of your file, you must do it from the Organizer itself (left panel of record). This means that you are working with already imported files (you can not import duplicates). You can organize in this folder on the same panel as if you were in Solution Explorer / finder. You can either use the 'move' menu or drag and drop of folders with their subfolders, you can move the files of images to other subfolders. Beware, there are traps in doing this, for example by trying to move a subfolder in master already a folder with the same name of subfolder...
So, ask yourself if all this work is really worth. And be patient and prudent to do this task from the file Organizer Panel.
-
Passing the record in function type [error: identifier must be declared]
Hello
I have a record defined in my procedure type
type chk_tab is (record
effective date,
County number (9)
)
type chk_typ is table of chk_tab of binary integer index;
chk_typ_rec chk_typ;
I have to pass another function of the effect and the County, tried doin as below:
function name: func_chk_typ
func_chk_typ (effect, count);
This property returns a saying "identifier effect must be reported.
I need to pass those values to registration in the service type, how more of this coming?
Any help is appreciated.Hi Camilla,
Find code below.
The function code:
CREATE OR REPLACE FUNCTION fetch_band(eff in date,ineff in date) return number is lu_cb_sysid NUMBER; BEGIN select fk_cb_sysid into lu_cb_sysid from ia_for_icon where cr_ans_date >= eff and cr_ans_date < ineff; RETURN lu_cb_sysid; END fetch_band;
Code of procedure. Here, I joined the service.
CREATE OR REPLACE procedure abc(a varchar, b number) is type cns_tab_record is record( eff date, ineff date); type cns_tab_typ is table of cns_tab_record index by binary_integer; cns_tab cns_tab_typ; v_lu_cb_sysid NUMBER; BEGIN -- Here you have to assign the values to your table type record. -- For example I am passing two values SYSDATE and SYSDATE - 10 cns_tab(1).eff := SYSDATE; cns_tab(1).ineff := SYSDATE - 10; v_lu_cb_sysid:= fetch_band(cns_tab(1).eff, cns_tab(1).ineff); END abc;
But I wonder why you use the data type here table type.
Hope code above will help you.
Thank you
Suri -
How we prevent insert if the record with same EmpName exist in the database?
Hi all
My use case is as follows:
The values of user input in a form of the adf, which includes a field EmpName. Then click on submit button. If that name exists in the database, user should not be allowed to save this record and shown an alert in place that says: 'record' already exists.
All solutions?
Here's what you'll need:
http://www.gabrielsideras.com/2010/09/28/ADF-unique-key-validation/
-
Insert the results of the query with constants
I need to select a table primary keys, then insert them into another table with a status value.
Select SQL would SELECT APP_ID OF PLAINTIFF WHERE LAST_NAME 'L % '.
I need all the APP_IDs insert into a table along a status of "in PROGRESS". The table has two columns; ID and the STATE.
How to combine these operations?You can try
Insert into your_table(ID,STATUS) SELECT APP_ID ID,'IN PROGRESS' STATUS FROM APPLICANT WHERE LAST_NAME LIKE 'L%'; commit;
Maybe you are looking for
-
Impossible to delete cookies from XP. 17 Firefox
I have Firefox set to delete cookies when it is closed. After I closed Firefox, I've generally run CC Cleaner. In the analysis, CC Cleaner shows 307 cookies with a total space of 0. Under XP, I went to Options, privacy and show Cookies. There are pro
-
I have a Nettalk phone, and I received a message has a peripheral RNDIS TK6000 network driver problem and received a message that the windows blocked because of problems
-
I can access a C++ object using the QmlDocument function-> setContextProperty() in JavaScript inside most of the QML elements (such as containers, ImageButton, control etc.) happened, but can't access it from the JavaScript inside ListView. I get "Re
-
BlackBerry smartphones can not open the chat box on bbm, please help
I think I typed the end instead of clear cat cat and now I can't open the chat boxes to one of my bbm contacts. How to re-enable this?
-
Dirt from under the screen blackBerry Smartphones
Am I the only one having dirt/dust accumulate on my screen. It started as one or two particles little, but now, there are at least 30 or 40. It's very embarrassing when you watch videos or you to browse.