Getting the name of the varray
Getting the original name of the Varray:
9.2.0.6
I have a simple procedure which does work but I would like to tighten it up.
procedure printVarray(u IN numUsed, varrayName IN VARCHAR2 DEFAULT NULL) is
begin
IF varrayName IS NOT NULL THEN
dbms_output.put_line('Working on Varray ' || varrayName);
for i in u.first..u.last loop
dbms_output.put_line('u[' || i || '] = ' || u(i).num || ' '
|| u(i).cnt);
end loop;
dbms_output.put_line(' ');
END IF;
end printVarray;
assuming u1 , u2, u3 & u4 are initialized and has values then
I can from a block do
begin
printVarray(u1,'u1');
printVarray(u2,'u2');
printVarray(u3,'u3');
printVarray(u4,'u4');
end;
and get the output I would expect:
... lines not show above
Working on Varray u3
u[1] = 1 2
u[2] = 2 3
u[3] = 3 4
u[4] = 4 3
Working on Varray u4
u[1] = 1 1
u[2] = 2 2
u[3] = 3 3
u[4] = 4 3
My question is how can I do away with passing the name of the original varray
to the procedure printVarray and still have it print the name of the original
varray?
Thanks
Not possible in PL/SQL dynamically if you're thinking alone those lines. You will need to pass a separate (manual) varchar2 parameter containing the name of the variable - as your printVarray() proc is currently doing.
You can simply change the DBMS_OUTPUT to:
dbms_output.put_line( varrayName||'[' || i || '] = ' || u(i).num || ' '
|| u(i).cnt);
Similar Messages
-
How to get the table name in the trigger definition without hard coding.
CREATE TRIGGER db.mytablename
AFTER UPDATE,INSERT
AS
INSERT INTO table1(col1)
SELECT InsRec.col1
FROM
INSERTED Ins
--Below i am calling one sp for which i have to pass the table name
EXEC myspname 'tablename'
In the above trigger,presently i am hard coding the tablename
but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table nameI really liked your audit table concept. You inspired me to modify it so that, the entire recordset gets captured and added a couple of other fields. Wanted to share my end result.
USE [YourDB]
GO
/****** Object: Trigger [dbo].[iudt_AutoAuditChanges] Script Date: 10/18/2013 12:49:55 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[iudt_AutoAuditChanges]
ON [dbo].[YourTable]
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
SET NOCOUNT ON;
Declare @v_AuditID bigint
IF OBJECT_ID('dbo.AutoAudit','U') IS NULL BEGIN
CREATE TABLE [dbo].[AutoAudit]
( [AuditID] bigint identity,
[AuditDate] DateTime,
[AuditUserName] varchar(128),
[TableName] varchar(128) NULL,
[OldContent] XML NULL,
[NewContent] XML NULL
ALTER TABLE dbo.AutoAudit ADD CONSTRAINT
PK_AutoAudit PRIMARY KEY CLUSTERED
[AuditID]
) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
CREATE NONCLUSTERED INDEX [idx_AutoAudit_TableName_AuditDate] ON [dbo].[AutoAudit]
( [TableName] ASC,
[AuditDate] ASC
)WITH (STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
END
Select * Into #AuditDeleted from deleted
Select * Into #AuditInserted from inserted
While (Select COUNT(*) from #AuditDeleted) > 0 OR (Select COUNT(*) from #AuditInserted) > 0
Begin
INSERT INTO [dbo].[AutoAudit]
( [AuditDate], [AuditUserName], [TableName], [OldContent], [NewContent])
SELECT
GETDATE(),
SUSER_NAME(),
[TableName]=object_name([parent_obj]),
[OldContent]=CAST((SELECT TOP 1 * FROM #AuditDeleted D FOR XML RAW) AS XML),
[NewContent]=CAST((SELECT TOP 1 * FROM #AuditInserted I FOR XML RAW) AS XML)
FROM sysobjects
WHERE
[xtype] = 'tr'
and [name] = OBJECT_NAME(@@PROCID)
Set @v_AuditID = SCOPE_IDENTITY()
Delete from AutoAudit
Where AuditID = @v_AuditID
AND Convert(varchar(max),oldContent) = Convert(varchar(max),NewContent)
Delete top(1) from #AuditDeleted
Delete top(1) from #AuditInserted
End
END -
Need help on getting the column names of Tabletype
I have a table Mapping with the following values: This Mapping table contains the table names (in Tabname) and the column names(colname) of various tables and values(ValuesTobeFilled) for the columns.
I have to insert into the tables present in the Tabname field with the values present in the ValuesTobeFilled in the columns present in the Colname field.
Note: The Mapping table need not contain all the columns of the base table. The columns that are not present can be filled with null. And this mapping table is not fixed i.e. rows can be inserted/deleted frequently.
Sample values in mapping table:
Tabname Colname ValuesTobeFilled
sample_items Eno Corresponding Expression to get the values from XML input
sample_items Ename Corresponding Expression to get the values from XML input
XXX YYY Corresponding Expression to get the values from XML input
Before filling in the actual tables, I have to store the entire data temporarily and I have used a tabletype declared as follows:
TYPE T_sample_items IS TABLE OF sample_items%ROWTYPE INDEX BY BINARY_INTEGER;
l_sample_items T_sample_items;
Where the table sample_items have the following columns:
• Eno
• Ename
• Eaddress
• Eemail
So, the tabletype should be filled as:
Eno Ename Eaddress EEmail
1 XXX - -
I have declared a cursor to select the values from mapping table and I need to fill in the ValuesTobeFilled values to the corresponding table.
CURSOR c_xpath (c_tname mapping.TABNAME%type)
IS
select * from mapping where tabname = c_tname;
CURSOR c_tables
IS
SELECT DISTINCT TABNAME FROM mapping;
FOR crsr IN c_tables
LOOP
p_tname := CRSR.TABNAME;
FOR csr IN c_xpath(p_tname)
LOOP
IF l_xml_doc.EXISTSNODE(CSR.XPATH_EXP) = 1
THEN
l_node_value := l_xml_doc.extract(CSR.XPATH_EXP).getStringVal(); -- This is the value to be stored in the corresponding column
ELSE
l_node_value := NULL;
END IF;
IF CSR.COLUMN_NAME = ‘eno’
THEN
l_sample_items(1).eno := l_node_value;
ELSIF CSR.COLUMN_NAME = ‘ename’
THEN
l_sample_items(1).name := l_node_value;
END IF;
END LOOP;
END LOOP;
And I need to eliminate hard coding while comparing the column names (in the following piece of code) as the Mapping table values are subject to insertion/deletion:
IF CSR.COLUMN_NAME = ‘eno’
THEN
l_sample_items(1).eno := l_node_value;
ELSIF CSR.COLUMN_NAME = ‘ename’
THEN
l_sample_items(1).ename := l_node_value;
END IF;
I need to insert the values directly into the tabletype without this hardcoding. Please suggest me ways to compare the mapping table values with the field (column) names of the tabletype. If it is not possible using tabletype, please suggest any other ways of fixing the problem.
Many thanks,
GopiI take it this isn't going to be a serious production system at the end of the day?
Storing metadata in tables for extraction and insertion of data is just wrong in so many ways. It smells heavily of Entity Attribute Value modelling, which is the most wrong way to use a relational database and is known to have major performance implications and be liable to bugs and issues. The idea that EAV modelling allows for 'generic' databases where new data items can be added flexibly later on without having to change code is usually justified with an excuse of "it means we don't have to update all our tables when we want a new column" which is easily countered with "if you're adding a single column a good relational design wouldn't require you to add it to more than one table anyway in most cases".
Just what exactly are you trying to do and why? There has to be a better way. -
Cisco Unity 7: Voice mail cann't get the name or Number phone of the caller
Hi,
I have installed Cisco Unity Messaging Unified version 7 and integrated with Exchange 2010.
I have two scenario, and I want to know if are normal or not:
1. If the 2 IP phones are subscribed with Cisco Unity: the first IP phone call the other IP phone and let a voice mail. When the second IP phone check his message vocal it can get the name of the caller or his number phone (the message is: You have One message from XXXX) and he get e-mail as objet: Voice Mail from XXXX.
2. If one IP phone is not subscriber with cisco unity call other Ip phone subscribed with cisco unity and let him a voice mail. The second IP phone when check his message vocal it can’t get the name of the caller or his number phone: The message is: You have one voice mail xxxx; without indicate from!! and he get a e-mail as object: Voice mail from Unknown.
Please, I want to know if the second scenario is normal ? if not, who to resolve this problem? I want that he indicate the number of caller same he isn't subscriber with cisco unity?
Thanks a lot,
Best regards,
Omar YUNSISo for the 2nd scenerio you would want to check what your Message Subjects were set to. For Unity 7 open Web SA, click Configuration and then Message Subjects. Make sure that the Outside Caller Message has %CALLERID% in it somewhere. The value %CALLERNAME% will return unknown if we do not receive a name from the PSTN.
Try setting the Outside Caller Message to:
%U% %P% Voice Message from %CALLERID%
and that should get you your desired results.
The default Message subject is:
%U% %P% Voice Message from %CALLERNAME% (%CALLERID%). So with that it would say Voice Message fom Unknown (xxxx) if it was not able to determine the name of the user which is usually normal from a PSTN call.
Just to note, the From address is always going to say from Unity Messaging System, it will only be the subject that has the extension in it.
Bryan -
How can I get the Voice memo's source computer file to keep the original file name?
I ran out of space in my iPhone some weeks ago and I've been cleaning up. I am pretty much done deleting the photos and apps. The only thing I need to finish is erasing my voice memos. I already synced my music/voice memos with my computer, the only problem is that when I get the files from the iTunes media it changes the name and makes it extremely hard to organize. I want to upload this files to another website so I can access them freely.
I would REALLY appreciated if anyone could tell me how to fix this or if you have another method please tell me.This is pretty straightforward.
If the file isn't too big you can just read the entire file contents:
set fileContents to read file "HD:path:to:the:file.txt"
Once you've read it in, you can iterate through it with a repeat loop like:
repeat with eachParagraph in (paragraphs of fileContents)
-- code here to process each line
end repeat
Within the loop, eachParagraph represents each successive line in the file, so all you need to do is pull out the data you want. Now your subject says that your file is tab-delimited, but your example uses commas, so you may need to adjust this script depending on what's actually the case:
set my text item delimiters to tab -- or "," as appropriate
set firstName to text item 1 of eachParagraph
set lastName to text item 2 of eachParagraph
set emailAddr to last text item of eachParagraph
-- rest of code here to send an email
The last thing to do is to reset the 'text item delimiters' to their previous value so you don't end up getting confused.
So, putting that all together you end up with something like:
set fileContents to read file "HD:path:to:the:file.txt"
set oldTIDs to my text item delimiters -- additional code to remember the current TIDs
set my text item delimiters to tab -- or ","
repeat with eachParagraph in (paragraphs of fileContents)
set firstName to text item 1 of eachParagraph
set lastName to text item 2 of eachParagraph
set emailAddr to last text item of eachParagraph
-- rest of code here to send an email
end repeat
set my text item delimiters to oldTIDs -- restore the TIDs for cleanliness
Note that this should work for reasonably-sized files (up to a few thousand records). If it's much more than that you may need something a little more sophisticated to read the file progressively rather than all at once. -
How can I get the host name from Email address?
hi
When I using socket to develope an email-sending servlet,I don't know how to get the host name from emial address.can you help me,thanksStripping off the user name will give you the domain of from field in the message. This is not the same as the host. Take a look at:
http://www.stopspam.org/email/headers/headers.html
Theres a pretty good discussion about email headers and how to use the information. You probably want to check the information here against the RFC.
Sean -
Trying to use Web LCID property to get the List name in client object Model
Hi ,
I am trying to change the "Personal Documents" list NoCrawl property under MySite using SharePoint Client Object Model. As we use web.Lists.GetByTitle("Personal
Documents"); method to get the list,but here problem is :for different language List name is in their language.So I tried to use LCID property of the WEB and
have taken key-value pair (PersonalSiteOnet_List_PersonalDocuments) from the resource file for that language from 14 hive.
Example:I have selected Spanish language .there are so many LCID for Spanish language but Microsoft has given only one language pack for Spanish.
Then,My Question is that
"All LCID for Spanish language are using same Spanish language pack dictionary file OR something else"
Hi,
According to your post, my understanding is that your requirement is getting list in different language.
Here are two ways for your reference:
1. We can use getById method instead, so that we can avoid the language issue.
2. We can use an array to store the different list name in different language in you JavaScript code, then use the code snippet below to get the list:
var userLcid =_spPageContextInfo.currentLanguage;
var localizedStrings = {
ListName: {
_1033: "EnglishName",
_3082: "SpanishName"
var listName=localizedStrings.ListName["_" + userLcid];
var list=web.Lists.getByTitle(listName);
More information:
http://msdn.microsoft.com/en-us/library/hh670609.aspx
http://wellytonian.com/2012/11/language-packs-sharepoint-2010/
Best Regards
Dennis Guo
TechNet Community Support -
I have done extensive programming with the SQL Toolkit with LabVIEW versions through 6.1. My customer now wants to upgrade to Windows 7, so I am trying to upgrade to LabVIEW 2009 (my latest purchased version) using the Database Connectivity Toolkit, and the SQL Toolkit Compatibility vis. Everything seemed to be going okay with the higher level SQL operations, but I ran into trouble with the Get Column Name.vi.
The pictures below show the problem. The original SQL Toolkit connected the Prepare SQL.vi with the Get Column Name.vi with a cluster of two references, one for connection, and one for sql. The new compatibility vis have a class conflict in the wire because the Prepare SQL.vi contains a cluster with connection, and command references, but the Get Column Name.vi expects a cluster with connection and recordset references.
How do I resolve this conflict?
Thank You.
DanI've never worked with the old version of the toolkit, so I don't know how it did things, but looking inside the SQL prep VI, it only generates a command, and the the column name VI wants a recordset. I'm not super familiar with all the internals of ADO, but my understanding is that is standard - you only have the columns after you execute the command and get the recordset back. What you can apparently do here is insert the Execute Prepared SQL VI in the middle and that will return what you need.
I'm not sure why it worked before. Maybe the execute was hidden inside the prep VI or maybe you can get the column names out of the command object before execution. In general, I would recommend considering switching to the newer VIs.
Try to take over the world! -
Any Function module or BAPIs are available to get scheme name for the inter
I have internal order no value in table AUFK-AUFNR , and the internal order corresponding Scheme value is available in IMPR-PRNAM . Now I want to inner join both the tables to extract the data , but there is no common field . Is there any Function module or BAPIs are available to get scheme name for the internal orders?
look at DB-VIEW "V_IVP_OR".
Regards,
Laurent -
ST22 , Need to get the Transaction and Pgm name using a FUNCTION MODULE ?
Hi All,
I need to create a Report for monitoring Dumps which is seen in ST22 every day.
The function module RS_ST22_GET_DUMPS gives the dump information . But i need to fetch the Program name and the transaction where the dump has happened for my report.(Like when we double click the alv output in ST22 and the next list gives us the complete information , Transaction , Main program name ...etc)
Kindly suggest me and help me on this .
Regards,
Richard AHi
Funcion module RS_ST22_GET_DUMPS will return the program names where the dump has taken place.
Pass this program name to function module RPY_TRANSACTION_READ to get the trascation code of the program.
Regards
Srilaxmi -
I cannot open Pages documents that I have worked on and saved. When I try to reopen Pages documents that I've saved, I get the following
message:
"The document “[name of document]” could not be opened. The file isn’t in the correct format.
The file might be corrupted, truncated, or in an unexpected format."
I have downloaded the latest update to iWork, but that doesn't help.
I use Mac OSX 10.6.7
I am using Pages '09 version 4.0.5 (852)
If anyone can help, I would greatly appreciate it.
Best regards,
New York Mac UserA few general trouble shooting tips that may apply here:
1. If you used Software Update to do the OS update(s) to reach 10.6.7, go to http://support.apple.com/downloads/ and download and apply the Mac OS v10.6.7 Combo Updater. The Combo Updater contains some fixes that were not included in the incremental updaters used by Software Update.
1a. Check that you have the current version of Pages (and of the other iWork applications) installed. All three applications' current version numbers end in .0.5
2. A common cause of malfunctioning applications is a corrupted preferences file (.plist file). Your Pages '09's plist is at yourname > Library > Preferences > com.apple.iWork.pages.plist
Quit Pages, locate the file and Drag it to the Desktop (or to the Trash).
Restart Pages and attempt to open one of the files.
If all is well, Trash the plist file and empty the Trash.
If there's no change, AND you've made changes to the Preferences that you wish to keep, drag the file back to its previous location, replacing any new one that has been created.
Regards,
Barry -
How to get the query name from portal report name
Hi Experts ,
I am given a portal report Name and asked to do changes to the queries of that ,so how do i get the query name ,
Thanks in Advance
NityaHi Nithya,
You can get the technical name by selecting the role in the portal where the report is enclosed you will generally find the report in description then identify the report you are looking then double click on that you will get a window pop-up in that you will have details tab there click on the details the your Query technical name will be displayed.
EX : zqry_w001 Then replace W with Q and seach in analyser or Designer.
Regards
Amar. -
Getting the variant name when the report program is run in background
Hi All,
How to get the variant name for the report program when run in background? My requirement is to create an email attachement with the name 'variant.XLS', where variant = selection screen variant, when the report program is run in background. The system field SY-SLSET holds the variant name only when run online.
Any pointers to this will be highly appreciated.
Thanks and regards,
Nilesh.Hello Nilesh,
Please find the algo:
1. Call the FM: GET_JOB_RUNTIME_INFO to get the background job details.
2. Select data from TBTCP using these details:
DATA:
FP_EVENTID TYPE BTCEVENTID
FP_EVTPARM TYPE BTCEVTPARM
FP_ACTIVE TYPE BTCXPGFLAG
FP_JOBCNT TYPE BTCJOBCNT
FP_JOBNM TYPE BTCJOB
FP_STEPCNT TYPE BTCSTEPCNT.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
EVENTID = FP_EVENTID
EVENTPARM = FP_EVTPARM
EXTERNAL_PROGRAM_ACTIVE = FP_ACTIVE
JOBCOUNT = FP_JOBCNT
JOBNAME = FP_JOBNM
STEPCOUNT = FP_STEPCNT
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Error calling FM: GET_JOB_RUNTIME_INFO
ENDIF.
DATA: FP_VARIANT TYPE BTCVARIANT.
SELECT JOBNAME JOBCOUNT STEPCOUNT VARIANT
FROM TBTCP
INTO TABLE L_IT_TBTCP
WHERE JOBNAME = FP_JOBNM
AND JOBCOUNT = FP_JOBCNT
AND STEPCOUNT = FP_STEPCNT.
IF SY-SUBRC = 0.
SORT L_IT_TBTCP BY JOBNM JOBCNT STEPCNT.
READ TABLE L_IT_TBTCP INTO L_WA_TBTCP INDEX 1.
IF SY-SUBRC = 0.
FP_VARIANT = L_WA_TBTCP-VARIANT.
ENDIF.
ENDIF.
Hope this helps.
BR,
Suhas -
How do i get the value in a variable that I don't know the name of til run
I have a record type( pr_team) defined in a package - anchored to a table.
I want to be able to go through each of the fields in it one at a time. I get the list of fields from the table definition from cursor as follows
CURSOR c_fields IS
SELECT column_name
FROM all_tab_cols
WHERE owner = 'CDS'
AND table_name = 'TEAM';
r_fields c_fields%ROWTYPE;
So first returned value is team_id
how can I get this value when all I know the field name is 'pr_team.' || r_fields.column_name
cheers
SimonOracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> CREATE OR REPLACE PACKAGE package_name
2 AS
3 r_emp emp%ROWTYPE;
4 END package_name;
5 /
Package created.
SQL> SET SERVEROUTPUT ON SIZE UNLIMITED;
SQL> DECLARE
2 v_empno emp.empno%TYPE;
3 v_ename emp.ename%TYPE;
4 BEGIN
5 SELECT *
6 INTO package_name.r_emp
7 FROM emp
8 WHERE ROWNUM = 1;
9
10 EXECUTE IMMEDIATE
11 'BEGIN ' ||
12 ' :v_empno := package_name.r_emp.empno; ' ||
13 ' :v_ename := package_name.r_emp.ename; ' ||
14 'END;'
15 USING OUT v_empno, OUT v_ename;
16
17 DBMS_OUTPUT.PUT_LINE ('v_empno => ' || v_empno);
18 DBMS_OUTPUT.PUT_LINE ('v_ename => ' || v_ename);
19 END;
20 /
v_empno => 7369
v_ename => SMITH
PL/SQL procedure successfully completed.
SQL> -
How to get the job logs from sm35 by using the queue id and session name?
hi all,
can any one please let me know how to read the job log from sm35 by using the session name and queue id. i have the job name and job count but is it possible to download the job log by using the queue id and session name.
FYI..
i want to read this job log and i want to send it to an email id.
-> i am using the job_open and submitting the zreport via job name and job count and then i am using the function module job_close.
but this is not working in my scenario i have the queue id and session name by using this two i want to get the job log is there any function module available or code please provide me some inputs.
thanks in advance,
koushikHi Bharath,
If you want to download it to the local file then you can follow the instructions in the below link.
How to download Batch Input Session Log?
Regards,
Sachin
Maybe you are looking for
-
I'm trying to find out information on how to go about helping my sister to register her new nano and load on CD's and such. I have a nano and already know how to do this but she is from CA and we want to load it here on my computer. She will be going
-
Multiple barcodes in a dynamic form don't work
Hi everybody I have a form in which I can add new items using instanceManager. I want to capture the data from each item i separate barcodes, and here comes the problem. I can make the barcode capture data from the first item in the form, but when I
-
Hi, I'm having problem when export and zoom the crystal report. Error "Missing parameter" occur when i click the export or zoom button. The error only occur when I group the data using a datetime variable. For grouping using integer, it was work
-
Call park music on hold reverts to default after server reboot
Hello, We are noticing that if you define Music on hold for the Park service, the call park music on hold reverts to default sound after server reboot. (all systems we've tested do this) Anyone using park music on hold that can verify one way or the
-
Help! My externals won't mount!
HELP! Neither of my external hard drives, both AC powered, suddenly won't mount. I've swapped all the cables and ports but no joy - it can only be the mac. Any idea?! Maybe I haven't mounted them since the last software/ security update, I can't reme